pub struct BerReader<'a> { /* private fields */ }Expand description
Zero-copy BER decoder over a byte slice.
Implementations§
Source§impl<'a> BerReader<'a>
impl<'a> BerReader<'a>
pub fn new(input: &'a [u8]) -> Self
pub fn with_max_depth(self, max: u16) -> Self
pub fn with_max_element_size(self, max: u32) -> Self
pub fn is_empty(&self) -> bool
pub fn remaining(&self) -> &'a [u8] ⓘ
Sourcepub fn peek_tag(&self) -> Result<Tag, BerError>
pub fn peek_tag(&self) -> Result<Tag, BerError>
Peek at the tag of the next element without consuming it.
Sourcepub fn read_element(&mut self) -> Result<(Tag, &'a [u8]), BerError>
pub fn read_element(&mut self) -> Result<(Tag, &'a [u8]), BerError>
Read the next TLV element, returning (tag, value_bytes).
Sourcepub fn read_sequence<F, T>(
&mut self,
expected_tag: Tag,
f: F,
) -> Result<T, BerError>
pub fn read_sequence<F, T>( &mut self, expected_tag: Tag, f: F, ) -> Result<T, BerError>
Read a constructed element (SEQUENCE, SET, or context-tagged), passing a sub-reader scoped to its contents.
Sourcepub fn read_sequence_lax<F, T>(
&mut self,
expected_tag: Tag,
f: F,
) -> Result<T, BerError>
pub fn read_sequence_lax<F, T>( &mut self, expected_tag: Tag, f: F, ) -> Result<T, BerError>
Like read_sequence but allows trailing data in the constructed element.
pub fn read_integer(&mut self) -> Result<i64, BerError>
pub fn read_octet_string(&mut self) -> Result<&'a [u8], BerError>
pub fn read_boolean(&mut self) -> Result<bool, BerError>
pub fn read_enumerated(&mut self) -> Result<i64, BerError>
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