Struct similar::InlineChange[][src]

pub struct InlineChange<'s, T: DiffableStr + ?Sized> { /* fields omitted */ }

Represents the expanded textual change with inline highlights.

This is like Change but with inline highlight info.

Implementations

impl<'s, T: DiffableStr + ?Sized> InlineChange<'s, T>[src]

pub fn tag(&self) -> ChangeTag[src]

Returns the change tag.

pub fn old_index(&self) -> Option<usize>[src]

Returns the old index if available.

pub fn new_index(&self) -> Option<usize>[src]

Returns the new index if available.

pub fn values(&self) -> &[(bool, &'s T)][src]

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.

pub fn iter_strings_lossy(&self) -> impl Iterator<Item = (bool, Cow<'_, str>)>[src]

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.

pub fn missing_newline(&self) -> bool[src]

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

impl<'s, T: Clone + DiffableStr + ?Sized> Clone for InlineChange<'s, T>[src]

impl<'s, T: Debug + DiffableStr + ?Sized> Debug for InlineChange<'s, T>[src]

impl<'s, T: DiffableStr + ?Sized> Display for InlineChange<'s, T>[src]

impl<'s, T: Eq + DiffableStr + ?Sized> Eq for InlineChange<'s, T>[src]

impl<'s, T: DiffableStr + ?Sized> From<Change<'s, T>> for InlineChange<'s, T>[src]

impl<'s, T: Hash + DiffableStr + ?Sized> Hash for InlineChange<'s, T>[src]

impl<'s, T: Ord + DiffableStr + ?Sized> Ord for InlineChange<'s, T>[src]

impl<'s, T: PartialEq + DiffableStr + ?Sized> PartialEq<InlineChange<'s, T>> for InlineChange<'s, T>[src]

impl<'s, T: PartialOrd + DiffableStr + ?Sized> PartialOrd<InlineChange<'s, T>> for InlineChange<'s, T>[src]

impl<'s, T: DiffableStr + ?Sized> StructuralEq for InlineChange<'s, T>[src]

impl<'s, T: DiffableStr + ?Sized> StructuralPartialEq for InlineChange<'s, T>[src]

Auto Trait Implementations

impl<'s, T: ?Sized> RefUnwindSafe for InlineChange<'s, T> where
    T: RefUnwindSafe

impl<'s, T: ?Sized> Send for InlineChange<'s, T> where
    T: Sync

impl<'s, T: ?Sized> Sync for InlineChange<'s, T> where
    T: Sync

impl<'s, T: ?Sized> Unpin for InlineChange<'s, T>

impl<'s, T: ?Sized> UnwindSafe for InlineChange<'s, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.