Struct similar::InlineChange
source · 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
sourceimpl<'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.
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
sourceimpl<'s, T: Clone + DiffableStr + ?Sized> Clone for InlineChange<'s, T>
impl<'s, T: Clone + DiffableStr + ?Sized> Clone for InlineChange<'s, T>
sourcefn clone(&self) -> InlineChange<'s, T>
fn clone(&self) -> InlineChange<'s, T>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<'s, T: Debug + DiffableStr + ?Sized> Debug for InlineChange<'s, T>
impl<'s, T: Debug + DiffableStr + ?Sized> Debug for InlineChange<'s, T>
sourceimpl<'s, T: DiffableStr + ?Sized> Display for InlineChange<'s, T>
impl<'s, T: DiffableStr + ?Sized> Display for InlineChange<'s, T>
sourceimpl<'s, T: DiffableStr + ?Sized> From<Change<&'s T>> for InlineChange<'s, T>
impl<'s, T: DiffableStr + ?Sized> From<Change<&'s T>> for InlineChange<'s, T>
sourcefn from(change: Change<&'s T>) -> InlineChange<'s, T>
fn from(change: Change<&'s T>) -> InlineChange<'s, T>
sourceimpl<'s, T: Hash + DiffableStr + ?Sized> Hash for InlineChange<'s, T>
impl<'s, T: Hash + DiffableStr + ?Sized> Hash for InlineChange<'s, T>
sourceimpl<'s, T: Ord + DiffableStr + ?Sized> Ord for InlineChange<'s, T>
impl<'s, T: Ord + DiffableStr + ?Sized> Ord for InlineChange<'s, T>
sourcefn cmp(&self, other: &InlineChange<'s, T>) -> Ordering
fn cmp(&self, other: &InlineChange<'s, T>) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl<'s, T: PartialEq + DiffableStr + ?Sized> PartialEq<InlineChange<'s, T>> for InlineChange<'s, T>
impl<'s, T: PartialEq + DiffableStr + ?Sized> PartialEq<InlineChange<'s, T>> for InlineChange<'s, T>
sourcefn eq(&self, other: &InlineChange<'s, T>) -> bool
fn eq(&self, other: &InlineChange<'s, T>) -> bool
sourceimpl<'s, T: PartialOrd + DiffableStr + ?Sized> PartialOrd<InlineChange<'s, T>> for InlineChange<'s, T>
impl<'s, T: PartialOrd + DiffableStr + ?Sized> PartialOrd<InlineChange<'s, T>> for InlineChange<'s, T>
sourcefn partial_cmp(&self, other: &InlineChange<'s, T>) -> Option<Ordering>
fn partial_cmp(&self, other: &InlineChange<'s, T>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more