Enum similar::algorithms::DiffOp [−][src]
Utility enum to capture a diff operation.
This is used by Capture
.
Variants
A segment is equal (see DiffHook::equal
)
A segment was deleted (see DiffHook::delete
)
A segment was inserted (see DiffHook::insert
)
A segment was replaced (see DiffHook::replace
)
Implementations
impl DiffOp
[src]
pub fn tag(self) -> DiffTag
[src]
Returns the tag of the operation.
pub fn old_range(&self) -> Range<usize>
[src]
Returns the old range.
pub fn new_range(&self) -> Range<usize>
[src]
Returns the new range.
pub fn as_tag_tuple(&self) -> (DiffTag, Range<usize>, Range<usize>)
[src]
Transform the op into a tuple of diff tag and ranges.
This is useful when operating on slices. The returned format is
(tag, i1..i2, j1..j2)
:
Replace
:a[i1..i2]
should be replaced byb[j1..j2]
Delete
:a[i1..i2]
should be deleted (j1 == j2
in this case).Insert
:b[j1..j2]
should be inserted ata[i1..i2]
(i1 == i2
in this case).Equal
:a[i1..i2]
is equal tob[j1..j2]
.
pub fn apply_to_hook<D: DiffHook>(&self, d: &mut D) -> Result<(), D::Error>
[src]
Apply this operation to a diff hook.
Trait Implementations
impl Clone for DiffOp
[src]
impl Copy for DiffOp
[src]
impl Debug for DiffOp
[src]
impl Eq for DiffOp
[src]
impl Hash for DiffOp
[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 PartialEq<DiffOp> for DiffOp
[src]
impl StructuralEq for DiffOp
[src]
impl StructuralPartialEq for DiffOp
[src]
Auto Trait Implementations
impl RefUnwindSafe for DiffOp
[src]
impl Send for DiffOp
[src]
impl Sync for DiffOp
[src]
impl Unpin for DiffOp
[src]
impl UnwindSafe for DiffOp
[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>,