Struct imara_diff::sink::Counter

source ·
pub struct Counter<T> {
    pub removals: u32,
    pub insertions: u32,
    pub wrapped: T,
}
Expand description

A Sink which wraps a different sink and counts the number of removed and inserted tokens.

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

Returns the “default value” for a type. Read more
This method is called whenever a diff algorithm finds a change between the two processed input file. A change is a continous subsequence of tokens before that needs to be replaced by a different contious subsequence of tokens after to construct the seconds file from the first. Read more
This function is called after all calls to process_change are complete to obtain the final diff result Read more
Utility method that constructs a Counter that tracks the total number of inserted and removed tokens in the changes passed to process_change. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.