pub struct CountingSource<'a, S> { /* private fields */ }Expand description
A RangedSource adapter that adds each count its source returns to a
caller-owned byte counter.
The counter is borrowed, so it keeps the bytes of the successful reads
before a failing one and can accumulate across short-lived adapters. It
saturates; reaching u64::MAX would take more reads than any input allows.
A count larger than the destination is passed on uncounted, for the
caller’s read helper to reject, unless Self::rejecting_overread makes
the adapter reject it first.
Implementations§
Source§impl<'a, S> CountingSource<'a, S>
impl<'a, S> CountingSource<'a, S>
Trait Implementations§
Auto Trait Implementations§
impl<'a, S> !UnwindSafe for CountingSource<'a, S>
impl<'a, S> Freeze for CountingSource<'a, S>
impl<'a, S> RefUnwindSafe for CountingSource<'a, S>where
&'a mut S: RefUnwindSafe,
impl<'a, S> Send for CountingSource<'a, S>
impl<'a, S> Sync for CountingSource<'a, S>
impl<'a, S> Unpin for CountingSource<'a, S>
impl<'a, S> UnsafeUnpin for CountingSource<'a, S>where
&'a mut S: UnsafeUnpin,
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