Struct similar::text::Change[][src]

pub struct Change<'s> { /* fields omitted */ }

Represents the expanded textual change.

This type is returned from the TextDiff::iter_changes method. It exists so that it's more convenient to work with textual differences as the underlying DiffOp does not know anything about strings.

Implementations

impl<'s> Change<'s>[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 value(&self) -> &'s str[src]

Returns the changed value.

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

Returns true for virtual changes.

Virtual changes are changes that do not exist in either diff but are necessary for a consistent user experience. This currently only applies to changes related to newline handling. If lines are passed to the TextDiff the TextDiff::newline_terminated flag is set in which case newlines of the input are included in the changes. However if the trailing newline is missing it would mess up processing greatly. Because of this a trailing virtual newline is automatically added for a more consistent user experience. This virtual newline can be detected by explicitly checking for this flag.

Trait Implementations

impl<'s> Clone for Change<'s>[src]

impl<'s> Copy for Change<'s>[src]

impl<'s> Debug for Change<'s>[src]

impl<'s> Eq for Change<'s>[src]

impl<'s> Hash for Change<'s>[src]

impl<'s> Ord for Change<'s>[src]

impl<'s> PartialEq<Change<'s>> for Change<'s>[src]

impl<'s> PartialOrd<Change<'s>> for Change<'s>[src]

impl<'s> StructuralEq for Change<'s>[src]

impl<'s> StructuralPartialEq for Change<'s>[src]

Auto Trait Implementations

impl<'s> RefUnwindSafe for Change<'s>[src]

impl<'s> Send for Change<'s>[src]

impl<'s> Sync for Change<'s>[src]

impl<'s> Unpin for Change<'s>[src]

impl<'s> UnwindSafe for Change<'s>[src]

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, 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.