pub struct CounterUnpacker<U: Unpacker> { /* private fields */ }Expand description
An Unpacker able to keep count of the number of read bytes.
Implementations§
Source§impl<U: Unpacker> CounterUnpacker<U>
impl<U: Unpacker> CounterUnpacker<U>
Sourcepub fn new(unpacker: U) -> Self
pub fn new(unpacker: U) -> Self
Creates a new CounterUnpacker.
Sourcepub fn into_inner(self) -> U
pub fn into_inner(self) -> U
Consumes the value to return the inner Unpacker.
Trait Implementations§
Source§impl<U: Unpacker> Unpacker for CounterUnpacker<U>
impl<U: Unpacker> Unpacker for CounterUnpacker<U>
Source§type Error = <U as Unpacker>::Error
type Error = <U as Unpacker>::Error
An error type representing any error related to reading bytes.
Source§fn unpack_bytes<B: AsMut<[u8]>>(&mut self, bytes: B) -> Result<(), Self::Error>
fn unpack_bytes<B: AsMut<[u8]>>(&mut self, bytes: B) -> Result<(), Self::Error>
Reads a sequence of bytes from the
Unpacker. This sequence must be long enough to fill bytes completely.
This method must fail if the unpacker does not have enough bytes to fulfill the request.Source§fn read_bytes(&self) -> Option<usize>
fn read_bytes(&self) -> Option<usize>
Returns the exact number of read bytes if possible.
Auto Trait Implementations§
impl<U> Freeze for CounterUnpacker<U>where
U: Freeze,
impl<U> RefUnwindSafe for CounterUnpacker<U>where
U: RefUnwindSafe,
impl<U> Send for CounterUnpacker<U>where
U: Send,
impl<U> Sync for CounterUnpacker<U>where
U: Sync,
impl<U> Unpin for CounterUnpacker<U>where
U: Unpin,
impl<U> UnwindSafe for CounterUnpacker<U>where
U: UnwindSafe,
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