Struct similar::algorithms::Replace [−][src]
A DiffHook
that combines deletions and insertions to give blocks
of maximal length, and replacements when appropriate.
It will replace DiffHook::insert
and DiffHook::delete
events when
possible with DiffHook::replace
events. Note that even though the
text processing in the crate does not use replace events and always resolves
then back to delete and insert, it's useful to always use the replacer to
ensure a consistent order of inserts and deletes. This is why for instance
the text diffing automatically uses this hook internally.
Implementations
impl<D: DiffHook> Replace<D>
[src]
pub fn new(d: D) -> Self
[src]
Creates a new replace hook wrapping another hook.
pub fn into_inner(self) -> D
[src]
Extracts the inner hook.
Trait Implementations
impl<D: DiffHook> AsMut<D> for Replace<D>
[src]
impl<D: DiffHook> AsRef<D> for Replace<D>
[src]
impl<D: DiffHook> DiffHook for Replace<D>
[src]
type Error = D::Error
fn equal(
&mut self,
old_index: usize,
new_index: usize,
len: usize
) -> Result<(), D::Error>
[src]
&mut self,
old_index: usize,
new_index: usize,
len: usize
) -> Result<(), D::Error>
fn delete(
&mut self,
old_index: usize,
old_len: usize,
new_index: usize
) -> Result<(), D::Error>
[src]
&mut self,
old_index: usize,
old_len: usize,
new_index: usize
) -> Result<(), D::Error>
fn insert(
&mut self,
old_index: usize,
new_index: usize,
new_len: usize
) -> Result<(), D::Error>
[src]
&mut self,
old_index: usize,
new_index: usize,
new_len: usize
) -> Result<(), D::Error>
fn replace(
&mut self,
old_index: usize,
old_len: usize,
new_index: usize,
new_len: usize
) -> Result<(), D::Error>
[src]
&mut self,
old_index: usize,
old_len: usize,
new_index: usize,
new_len: usize
) -> Result<(), D::Error>
fn finish(&mut self) -> Result<(), D::Error>
[src]
Auto Trait Implementations
impl<D> RefUnwindSafe for Replace<D> where
D: RefUnwindSafe,
[src]
D: RefUnwindSafe,
impl<D> Send for Replace<D> where
D: Send,
[src]
D: Send,
impl<D> Sync for Replace<D> where
D: Sync,
[src]
D: Sync,
impl<D> Unpin for Replace<D> where
D: Unpin,
[src]
D: Unpin,
impl<D> UnwindSafe for Replace<D> where
D: UnwindSafe,
[src]
D: UnwindSafe,
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, 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>,