//! Patience diff algorithm. //! //! * time: `O(N log N + M log M + (N+M)D)` //! * space: `O(N+M)` //! //! Tends to give more human-readable outputs. See [Bram Cohen's blog //! post](https://bramcohen.livejournal.com/73318.html) describing it. //! //! This is based on the patience implementation of [pijul](https://pijul.org/) //! by Pierre-Étienne Meunier. use std::hash::Hash; use std::ops::{Index, Range};
/// Patience diff algorithm with deadline. /// /// Diff `old`, between indices `old_range` and `new` between indices `new_range`. /// /// This diff is done with an optional deadline that defines the maximal /// execution time permitted before it bails and falls back to an approximation. pubfn diff_deadline<Old, New, D>(
d: &mut D,
old: &Old,
old_range: Range<usize>,
new: &New,
new_range: Range<usize>,
deadline: Option<Instant>,
) -> Result<(), D::Error> where
Old: Index<usize> + ?Sized,
New: Index<usize> + ?Sized,
Old::Output: Hash + Eq,
New::Output: PartialEq<Old::Output> + Hash + Eq,
D: DiffHook,
{ let old_indexes = unique(old, old_range.clone()); let new_indexes = unique(new, new_range.clone());
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.