Struct Reader
pub struct Reader<'a> { /* private fields */ }Expand description
A bounds-checked cursor over a byte slice.
Implementations§
§impl<'a> Reader<'a>
impl<'a> Reader<'a>
pub fn new(bytes: &'a [u8]) -> Self
pub fn remaining(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn rest(&self) -> &'a [u8] ⓘ
pub fn take(&mut self, n: usize) -> DecodeResult<&'a [u8]>
pub fn u8(&mut self) -> DecodeResult<u8>
pub fn u32(&mut self) -> DecodeResult<u32>
pub fn u64(&mut self) -> DecodeResult<u64>
pub fn varint(&mut self) -> DecodeResult<u64>
pub fn varint_u32(&mut self) -> DecodeResult<u32>
pub fn bytes(&mut self) -> DecodeResult<&'a [u8]>
pub fn bytes(&mut self) -> DecodeResult<&'a [u8]>
One length-prefixed payload or name: at most MAX_PAYLOAD bytes.
pub fn blob(&mut self) -> DecodeResult<&'a [u8]>
pub fn blob(&mut self) -> DecodeResult<&'a [u8]>
A length-prefixed container of records (a journal, a section, an
index): as long as what it holds, so bounded only by the input, which
a checksum already vouches for. Nothing is allocated for the length
it claims; each record inside meets bytes’s bound
when it is decoded.
pub fn str(&mut self) -> DecodeResult<&'a str>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for Reader<'a>
impl<'a> Freeze for Reader<'a>
impl<'a> Move 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