1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Functions for diff, match and patch.
//!
//! Computes the difference between two texts to create a patch.
//! Applies the patch onto another text, allowing for errors.
//!
//! All lengths in the delta and patch text wire formats count Unicode
//! scalars, and the outputs are byte-compatible with Neil Fraser's reference
//! diff-match-patch for text where scalar and UTF-16 counts agree (the
//! reference counts UTF-16 code units).
//!
//! ```
//! use diff_match_patch::Dmp;
//!
//! let mut dmp = Dmp::new();
//! let mut diffs = dmp.diff_main("The quick brown fox.", "The quick red fox.", true);
//! assert_eq!(dmp.diff_text1(&mut diffs), "The quick brown fox.");
//! assert_eq!(dmp.diff_text2(&mut diffs), "The quick red fox.");
//!
//! let mut patches = dmp.patch_make1("The quick brown fox.", "The quick red fox.");
//! let (patched, applied) = dmp.patch_apply(&mut patches, "The quick brown fox.");
//! assert_eq!(patched.into_iter().collect::<String>(), "The quick red fox.");
//! assert_eq!(applied, vec![true]);
//! ```
//!
//! With the `grapheme` feature enabled, [`Segmentation::Grapheme`] makes
//! diffs treat extended grapheme clusters (emoji ZWJ sequences, flags,
//! combining marks) as atomic:
//!
//! use diff_match_patch::{Dmp, Segmentation};
//!
//! let mut dmp = Dmp::new();
//! dmp.segmentation = Segmentation::Grapheme;
//! let diffs = dmp.diff_main("π·πΊ", "πΊπΈ", false);
//! // The flags share a scalar but not a cluster: no boundary lands inside one.
//! assert_eq!(diffs.len(), 2);
//! ```
pub use ;