pub struct Counter<T> {
pub removals: u32,
pub insertions: u32,
pub wrapped: T,
}
Available on crate feature
blob
only.Expand description
Fields§
§removals: u32
Total number of recorded inserted tokens
.
Computed by summing the lengths of the after
subsequences pass to process_change
.
insertions: u32
Total number of recorded inserted tokens
.
Computed by summing the lengths of the after
subsequences pass to process_change
.
wrapped: T
The Sink
for which the counter records tokens
.
All calls to process_change
are forwarded to the sink
by the counter.
After finish
is called, this field contains the output returned by the finish
method of the wrapped Sink
.
Implementations§
Trait Implementations§
source§impl<S> Sink for Counter<S>where
S: Sink,
impl<S> Sink for Counter<S>where
S: Sink,
type Out = Counter<<S as Sink>::Out>
source§fn finish(self) -> <Counter<S> as Sink>::Out
fn finish(self) -> <Counter<S> as Sink>::Out
This function is called after all calls to
process_change
are complete
to obtain the final diff resultsource§fn with_counter(self) -> Counter<Self>
fn with_counter(self) -> Counter<Self>
Utility method that constructs a
Counter
that tracks the total number
of inserted and removed tokens in the changes passed to process_change
.Auto Trait Implementations§
impl<T> Freeze for Counter<T>where
T: Freeze,
impl<T> RefUnwindSafe for Counter<T>where
T: RefUnwindSafe,
impl<T> Send for Counter<T>where
T: Send,
impl<T> Sync for Counter<T>where
T: Sync,
impl<T> Unpin for Counter<T>where
T: Unpin,
impl<T> UnwindSafe for Counter<T>where
T: 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