pub fn diff_lines<'a>(
    old: &str,
    new: &str,
    theme: &'a dyn ColorScheme,
    prefixes: (
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
    ),
) -> impl Iterator<Item = String> + 'a {
    let (same, add, rem) = prefixes;
    let make_line = move |diff: Difference| match diff {
        Same(line) => theme.diff_line_same().paint(add_prefix(line, same)),
        Add(line) => theme.diff_line_add().paint(add_prefix(line, add)),
        Rem(line) => theme.diff_line_rem().paint(add_prefix(line, rem)),
    };
    diff(old, new)
        .diffs
        .into_iter()
        .map(make_line)
        .map(|line| format!("{}", line))
}
/// Emit printable lines of diff.
Emit printable lines of diff.
Emit printable lines of diff .
pub fn diff_lines<'a>(
    old: &str,
    new: &str,
    theme: &'a dyn ColorScheme,
    prefixes: (
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
    ),
) -> impl Iterator<Item = String> + 'a {
    let (same, add, rem) = prefixes;
    let make_line = move |diff: Difference| match diff {
        Same(line) => theme.diff_line_same().paint(add_prefix(line, same)),
        Add(line) => theme.diff_line_add().paint(add_prefix(line, add)),
        Rem(line) => theme.diff_line_rem().paint(add_prefix(line, rem)),
    };
    diff(old, new)
        .diffs
        .into_iter()
        .map(make_line)
        .map(|line| format!("{}", line))
}
pub fn diff_lines < ' a > ( old : & str , new : & str , theme : & ' a dyn ColorScheme , prefixes : ( impl Display + Copy + ' a , impl Display + Copy + ' a , impl Display + Copy + ' a , ) , ) -> impl Iterator < Item = String > + ' a { let ( same , add , rem ) = prefixes ; let make_line = move | diff : Difference | match diff { Same ( line ) => theme . diff_line_same ( ) . paint ( add_prefix ( line , same ) ) , Add ( line ) => theme . diff_line_add ( ) . paint ( add_prefix ( line , add ) ) , Rem ( line ) => theme . diff_line_rem ( ) . paint ( add_prefix ( line , rem ) ) , } ; diff ( old , new ) . diffs . into_iter ( ) . map ( make_line ) . map ( | line | format ! ( " " line ) ) }
Emit printable lines of diff.
Emit printable lines of diff .
old
&str
new
&str
theme
&'a dyn ColorScheme
prefixes
(
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
    )
old
&str
new
&str
theme
&'a dyn ColorScheme
prefixes
(
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
        impl Display + Copy + 'a,
    )