pub struct UnifiedDiff<'a, T, D>{ /* private fields */ }
Available on crate feature
blob
only.Expand description
A Sink
that creates a textual diff in the format typically output by git or gnu-diff
if the -u
option is used,
and passes it in full to a consumer.
Implementations§
Source§impl<'a, T, D> UnifiedDiff<'a, T, D>
impl<'a, T, D> UnifiedDiff<'a, T, D>
Sourcepub fn new(
input: &'a InternedInput<T>,
consume_hunk: D,
newline_separator: NewlineSeparator<'a>,
context_size: ContextSize,
) -> Self
pub fn new( input: &'a InternedInput<T>, consume_hunk: D, newline_separator: NewlineSeparator<'a>, context_size: ContextSize, ) -> Self
Create a new instance to create unified diff using the lines in input
,
which also must be used when running the diff algorithm.
context_size
is the amount of lines around each hunk which will be passed
to consume_hunk
.
consume_hunk
is called for each hunk in unified-diff format, as created from each line separated by newline_separator
.
Trait Implementations§
Source§impl<T, D> Sink for UnifiedDiff<'_, T, D>
impl<T, D> Sink for UnifiedDiff<'_, T, D>
type Out = Result<<D as ConsumeHunk>::Out, Error>
Source§fn finish(self) -> Self::Out
fn finish(self) -> Self::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<'a, T, D> Freeze for UnifiedDiff<'a, T, D>where
D: Freeze,
impl<'a, T, D> !RefUnwindSafe for UnifiedDiff<'a, T, D>
impl<'a, T, D> Send for UnifiedDiff<'a, T, D>
impl<'a, T, D> Sync for UnifiedDiff<'a, T, D>
impl<'a, T, D> Unpin for UnifiedDiff<'a, T, D>where
D: Unpin,
impl<'a, T, D> !UnwindSafe for UnifiedDiff<'a, T, D>
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