Struct similar::text::Change [−][src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'s> Ord for Change<'s>
[src]
fn cmp(&self, other: &Change<'s>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<'s> PartialEq<Change<'s>> for Change<'s>
[src]
impl<'s> PartialOrd<Change<'s>> for Change<'s>
[src]
fn partial_cmp(&self, other: &Change<'s>) -> Option<Ordering>
[src]
fn lt(&self, other: &Change<'s>) -> bool
[src]
fn le(&self, other: &Change<'s>) -> bool
[src]
fn gt(&self, other: &Change<'s>) -> bool
[src]
fn ge(&self, other: &Change<'s>) -> bool
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,