summaryrefslogtreecommitdiffstats
path: root/vendor/similar/examples/patience.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/similar/examples/patience.rs')
-rw-r--r--vendor/similar/examples/patience.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/similar/examples/patience.rs b/vendor/similar/examples/patience.rs
new file mode 100644
index 0000000..4b898a6
--- /dev/null
+++ b/vendor/similar/examples/patience.rs
@@ -0,0 +1,48 @@
+use similar::{Algorithm, TextDiff};
+
+const OLD: &str = r#"
+[
+ (
+ Major,
+ 2,
+ ),
+ (
+ Minor,
+ 20,
+ ),
+ (
+ Value,
+ 0,
+ ),
+]
+"#;
+const NEW: &str = r#"
+[
+ (
+ Major,
+ 2,
+ ),
+ (
+ Minor,
+ 0,
+ ),
+ (
+ Value,
+ 0,
+ ),
+ (
+ Value,
+ 1,
+ ),
+]
+"#;
+
+fn main() {
+ println!(
+ "{}",
+ TextDiff::configure()
+ .algorithm(Algorithm::Patience)
+ .diff_lines(OLD, NEW)
+ .unified_diff()
+ );
+}