pub struct Diff<'input> { /* private fields */ }
Expand description
Takes any number of inputs and finds regions that are them same between all of them.
Implementations§
Source§impl<'input> Diff<'input>
impl<'input> Diff<'input>
pub fn for_tokenizer<T: AsRef<[u8]> + ?Sized + 'input>( inputs: impl IntoIterator<Item = &'input T>, tokenizer: impl Fn(&[u8]) -> Vec<Range<usize>>, compare: impl CompareBytes, ) -> Self
pub fn unrefined<T: AsRef<[u8]> + ?Sized + 'input>( inputs: impl IntoIterator<Item = &'input T>, ) -> Self
Sourcepub fn by_line<T: AsRef<[u8]> + ?Sized + 'input>(
inputs: impl IntoIterator<Item = &'input T>,
) -> Self
pub fn by_line<T: AsRef<[u8]> + ?Sized + 'input>( inputs: impl IntoIterator<Item = &'input T>, ) -> Self
Compares inputs
line by line.
Sourcepub fn by_word<T: AsRef<[u8]> + ?Sized + 'input>(
inputs: impl IntoIterator<Item = &'input T>,
) -> Self
pub fn by_word<T: AsRef<[u8]> + ?Sized + 'input>( inputs: impl IntoIterator<Item = &'input T>, ) -> Self
Compares inputs
word by word.
The inputs
is usually a changed hunk (e.g. a DiffHunk::Different
)
that was the output from a line-by-line diff.
Sourcepub fn hunks(&self) -> DiffHunkIterator<'_, 'input> ⓘ
pub fn hunks(&self) -> DiffHunkIterator<'_, 'input> ⓘ
Returns iterator over matching and different texts.
Sourcepub fn hunk_ranges(&self) -> DiffHunkRangeIterator<'_> ⓘ
pub fn hunk_ranges(&self) -> DiffHunkRangeIterator<'_> ⓘ
Returns iterator over matching and different ranges in bytes.
Sourcepub fn refine_changed_regions(
&mut self,
tokenizer: impl Fn(&[u8]) -> Vec<Range<usize>>,
compare: impl CompareBytes,
)
pub fn refine_changed_regions( &mut self, tokenizer: impl Fn(&[u8]) -> Vec<Range<usize>>, compare: impl CompareBytes, )
Uses the given tokenizer to split the changed regions into smaller regions. Then tries to finds unchanged regions among them.
Trait Implementations§
Auto Trait Implementations§
impl<'input> Freeze for Diff<'input>
impl<'input> RefUnwindSafe for Diff<'input>
impl<'input> Send for Diff<'input>
impl<'input> Sync for Diff<'input>
impl<'input> Unpin for Diff<'input>
impl<'input> UnwindSafe for Diff<'input>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more