pub struct CountedInput<'a, I: Input> { /* private fields */ }
Expand description
A wrapper for Input
which tracks the number fo bytes that are successfully read.
If inner Input
fails to read, the counter is not incremented.
It can count until u64::MAX - 1
accurately then saturate.
Implementations§
Trait Implementations§
Source§impl<I: Input> Input for CountedInput<'_, I>
impl<I: Input> Input for CountedInput<'_, I>
Source§fn remaining_len(&mut self) -> Result<Option<usize>, Error>
fn remaining_len(&mut self) -> Result<Option<usize>, Error>
Should return the remaining length of the input data. If no information about the input
length is available,
None
should be returned. Read moreSource§fn read(&mut self, into: &mut [u8]) -> Result<(), Error>
fn read(&mut self, into: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill the given buffer. Read more
Source§fn ascend_ref(&mut self)
fn ascend_ref(&mut self)
Ascend to previous structure level when decoding.
This is called when decoding reference-based type is finished.
Auto Trait Implementations§
impl<'a, I> Freeze for CountedInput<'a, I>
impl<'a, I> RefUnwindSafe for CountedInput<'a, I>where
I: RefUnwindSafe,
impl<'a, I> Send for CountedInput<'a, I>where
I: Send,
impl<'a, I> Sync for CountedInput<'a, I>where
I: Sync,
impl<'a, I> Unpin for CountedInput<'a, I>
impl<'a, I> !UnwindSafe for CountedInput<'a, I>
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