/// 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. pubstruct Replace<D: DiffHook> {
d: D,
del: Option<(usize, usize, usize)>,
ins: Option<(usize, usize, usize)>,
eq: Option<(usize, usize, usize)>,
}
impl<D: DiffHook> Replace<D> { /// Creates a new replace hook wrapping another hook. pubfn new(d: D) -> Self {
Replace {
d,
del: None,
ins: None,
eq: None,
}
}
/// Extracts the inner hook. pubfn into_inner(self) -> D { self.d
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.