blob: 98a58183552f3449b880a367634a505374d8b20e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
use similar::TextDiff;
fn main() {
let diff = TextDiff::from_lines(
"Hello World\nThis is the second line.\nThis is the third.",
"Hallo Welt\nThis is the second line.\nThis is life.\nMoar and more",
);
let all_changes = diff
.ops()
.iter()
.flat_map(|op| diff.iter_changes(op))
.collect::<Vec<_>>();
println!("{}", serde_json::to_string_pretty(&all_changes).unwrap());
}
|