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::>(); println!("{}", serde_json::to_string_pretty(&all_changes).unwrap()); }