pub struct Reader<'a> { /* private fields */ }Expand description
Reading cursor over a received buffer.
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
Sourcepub fn uint<const N: usize>(&mut self) -> Result<u64, ProtoError>
pub fn uint<const N: usize>(&mut self) -> Result<u64, ProtoError>
Read one unsigned little-endian integer of the given width.
Sourcepub fn u8v(&mut self) -> Result<u8, ProtoError>
pub fn u8v(&mut self) -> Result<u8, ProtoError>
Read a single byte.
Sourcepub fn take(&mut self, n: usize) -> Result<&'a [u8], ProtoError>
pub fn take(&mut self, n: usize) -> Result<&'a [u8], ProtoError>
Borrow the next n bytes without copying.
Sourcepub fn zstring(&mut self, unicode: bool, base: usize) -> String
pub fn zstring(&mut self, unicode: bool, base: usize) -> String
Read a NUL-terminated string honouring the SMB Unicode rules:
when unicode is set the cursor first skips one pad byte if the
current position is odd relative to base, then decodes UTF-16LE up
to and including the 16-bit terminator.
base must be the absolute frame offset of buf[0].
Sourcepub fn fixed_string(&mut self, len: usize, unicode: bool) -> String
pub fn fixed_string(&mut self, len: usize, unicode: bool) -> String
Read exactly len bytes as a lossy UTF-16LE or OEM string
(no terminator handling) — used for length-prefixed name fields.
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