pub struct BerReader<'a> { /* private fields */ }Expand description
A BER reader that decodes TLV elements from a byte slice.
Implementations§
Source§impl<'a> BerReader<'a>
impl<'a> BerReader<'a>
Sourcepub fn peek_tag(&self) -> Result<(u8, Class, bool), SleError>
pub fn peek_tag(&self) -> Result<(u8, Class, bool), SleError>
Peeks at the next tag without advancing the position.
Returns (tag_number, class, constructed).
Sourcepub fn read_tag(&mut self) -> Result<(u8, Class, bool), SleError>
pub fn read_tag(&mut self) -> Result<(u8, Class, bool), SleError>
Reads and validates a tag, returning its components.
Sourcepub fn read_length(&mut self) -> Result<usize, SleError>
pub fn read_length(&mut self) -> Result<usize, SleError>
Reads a length field.
Sourcepub fn read_raw(&mut self, len: usize) -> Result<&'a [u8], SleError>
pub fn read_raw(&mut self, len: usize) -> Result<&'a [u8], SleError>
Reads raw bytes of the given length.
Sourcepub fn read_integer(&mut self) -> Result<i64, SleError>
pub fn read_integer(&mut self) -> Result<i64, SleError>
Reads an ASN.1 INTEGER as i64.
Sourcepub fn read_octet_string(&mut self) -> Result<&'a [u8], SleError>
pub fn read_octet_string(&mut self) -> Result<&'a [u8], SleError>
Reads an ASN.1 OCTET STRING, returning the raw bytes.
Sourcepub fn read_sequence(&mut self) -> Result<usize, SleError>
pub fn read_sequence(&mut self) -> Result<usize, SleError>
Reads a SEQUENCE tag+length, returning the content length. The caller should then read the contained elements.
Auto Trait Implementations§
impl<'a> Freeze for BerReader<'a>
impl<'a> RefUnwindSafe for BerReader<'a>
impl<'a> Send for BerReader<'a>
impl<'a> Sync for BerReader<'a>
impl<'a> Unpin for BerReader<'a>
impl<'a> UnsafeUnpin for BerReader<'a>
impl<'a> UnwindSafe for BerReader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more