Add compaction support (#22)

This commit is contained in:
Armin Ronacher 2021-02-25 22:13:43 +01:00 committed by GitHub
parent ddb73d8351
commit 7e628d78d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 712 additions and 19 deletions

48
examples/patience.rs Normal file
View file

@ -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()
);
}