pub struct Reader<'a> { /* private fields */ }Expand description
A cursor over a byte slice with checked little-endian reads.
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
Sourcepub fn new(buf: &'a [u8]) -> Self
pub fn new(buf: &'a [u8]) -> Self
A reader that reports truncation as Check::DirChunkExtent.
Callers parsing a specific structure should prefer Reader::checked.
Sourcepub fn checked(buf: &'a [u8], check: Check) -> Self
pub fn checked(buf: &'a [u8], check: Check) -> Self
A reader whose truncation errors report check.
Sourcepub fn with_check(self, check: Check) -> Self
pub fn with_check(self, check: Check) -> Self
The same reader with a different truncation check.
Sourcepub fn varint(&mut self) -> Result<u64>
pub fn varint(&mut self) -> Result<u64>
Read a varint (section 5.2).
Sourcepub fn varint_bounded(&mut self, max: u64) -> Result<u64>
pub fn varint_bounded(&mut self, max: u64) -> Result<u64>
Read a varint bounded by max, rejecting a value above it before allocation.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Reader<'a>
impl<'a> RefUnwindSafe for Reader<'a>
impl<'a> Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnsafeUnpin for Reader<'a>
impl<'a> UnwindSafe for Reader<'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