fn print_diff(printer: &mut dyn LinePrinter, text1: &str, text2: &str) {
    let Changeset { diffs, .. } = Changeset::new(text1, text2, "\n");

    for diff in diffs {
        let (content, prefix, fmt) = match diff {
            Difference::Same(ref x) => (x, " ", &LineFormat::Text),
            Difference::Add(ref x) => (x, "+", &LineFormat::Success),
            Difference::Rem(ref x) => (x, "-", &LineFormat::Failure),
        };
        for line in content.lines() {
            printer.print_line(&format!("{}{}", prefix, line), fmt);
        }
    }
}
/// Prints a diff between two texts.
Prints a diff between two texts.
Prints a diff between two texts .
fn print_diff(printer: &mut dyn LinePrinter, text1: &str, text2: &str) {
    let Changeset { diffs, .. } = Changeset::new(text1, text2, "\n");
    for diff in diffs {
        let (content, prefix, fmt) = match diff {
            Difference::Same(ref x) => (x, " ", &LineFormat::Text),
            Difference::Add(ref x) => (x, "+", &LineFormat::Success),
            Difference::Rem(ref x) => (x, "-", &LineFormat::Failure),
        };
        for line in content.lines() {
            printer.print_line(&format!("{}{}", prefix, line), fmt);
        }
    }
}
fn print_diff ( printer : & mut dyn LinePrinter , text1 : & str , text2 : & str ) { let Changeset { diffs , .. } = Changeset :: new ( text1 , text2 , " \n " ) ; for diff in diffs { let ( content , prefix , fmt ) = match diff { Difference :: Same ( ref x ) => ( x , " " , & LineFormat :: Text ) , Difference :: Add ( ref x ) => ( x , " " , & LineFormat :: Success ) , Difference :: Rem ( ref x ) => ( x , " " , & LineFormat :: Failure ) , } ; for line in content . lines ( ) { printer . print_line ( & format ! ( " " prefix line ) , fmt ) ; } } }
Prints a diff between two texts.
Prints a diff between two texts .
printer
&mut dyn LinePrinter
text1
&str
text2
&str
printer
&mut dyn LinePrinter
text1
&str
text2
&str