Struct packable::unpacker::CounterUnpacker
source · 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§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> 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