pub struct Reader<'a> { /* private fields */ }Expand description
A cursor over a packet payload.
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
pub fn new(bytes: &'a [u8]) -> Self
pub fn is_empty(&self) -> bool
pub fn remaining(&self) -> usize
pub fn peek(&self) -> Option<u8>
pub fn take(&mut self, count: usize) -> Result<&'a [u8]>
pub fn skip(&mut self, count: usize) -> Result<()>
pub fn u8(&mut self) -> Result<u8>
pub fn u16(&mut self) -> Result<u16>
pub fn u32(&mut self) -> Result<u32>
pub fn u64(&mut self) -> Result<u64>
Sourcepub fn lenenc_int(&mut self) -> Result<u64>
pub fn lenenc_int(&mut self) -> Result<u64>
A length-encoded integer. 0xFB (NULL) is an error here; the callers
that allow it use Reader::lenenc_bytes_or_null.
pub fn lenenc_bytes(&mut self) -> Result<&'a [u8]>
pub fn lenenc_bytes_or_null(&mut self) -> Result<Option<&'a [u8]>>
pub fn cstr(&mut self) -> Result<String>
pub fn rest(&mut self) -> &'a [u8] ⓘ
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