pub struct InlineChange<'s, T: DiffableStr + ?Sized> { /* private fields */ }Expand description
Represents the expanded textual change with inline highlights.
This is like Change but with inline highlight info.
Implementations§
Source§impl<'s, T: DiffableStr + ?Sized> InlineChange<'s, T>
impl<'s, T: DiffableStr + ?Sized> InlineChange<'s, T>
Sourcepub fn values(&self) -> &[(bool, &'s T)]
pub fn values(&self) -> &[(bool, &'s T)]
Returns the changed values.
Each item is a tuple in the form (emphasized, value) where emphasized
is true if it should be highlighted as an inline diff.
Depending on the type of the underlying DiffableStr this value is
more or less useful. If you always want to have a utf-8 string it’s
better to use the InlineChange::iter_strings_lossy method.
Sourcepub fn iter_strings_lossy(&self) -> impl Iterator<Item = (bool, Cow<'_, str>)>
pub fn iter_strings_lossy(&self) -> impl Iterator<Item = (bool, Cow<'_, str>)>
Iterates over all (potentially lossy) utf-8 decoded values.
Each item is a tuple in the form (emphasized, value) where emphasized
is true if it should be highlighted as an inline diff.
By default, words are split by whitespace, which results in coarser diff.
For example: "f(x) y" is tokenized as ["f(x)", "y"].
If you want it to be tokenized instead as ["f(", "x", ")"],
you should enable the "unicode" flag.
Sourcepub fn missing_newline(&self) -> bool
pub fn missing_newline(&self) -> bool
Returns true if this change does not end in a newline and must be
followed up by one if line based diffs are used.
Trait Implementations§
Source§impl<'s, T: Clone + DiffableStr + ?Sized> Clone for InlineChange<'s, T>
impl<'s, T: Clone + DiffableStr + ?Sized> Clone for InlineChange<'s, T>
Source§fn clone(&self) -> InlineChange<'s, T>
fn clone(&self) -> InlineChange<'s, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more