fn print_struct_diff_with_indent(
    value1: &AnnotatedMoveStruct,
    value2: &AnnotatedMoveStruct,
    indent: u64,
) {
    let indent_str: String = (0..indent).map(|_| " ").collect::<String>();
    let prev_str = format!("{}", value1);
    let new_str = format!("{}", value2);

    let Changeset { diffs, .. } = Changeset::new(&prev_str, &new_str, "\n");

    for diff in diffs {
        match diff {
            Difference::Same(ref x) => {
                let lines = x.split('\n');
                for line in lines {
                    println!(" {}{}", indent_str, line);
                }
            }
            Difference::Add(ref x) => {
                let lines = x.split('\n');
                for line in lines {
                    println!("{}{}{}", "+".green(), indent_str, line.green());
                }
            }
            Difference::Rem(ref x) => {
                let lines = x.split('\n');
                for line in lines {
                    println!("{}{}{}", "-".red(), indent_str, line.red());
                }
            }
        }
    }
}
// Print struct diff with a specified outer indent
Print struct diff with a specified outer indent
Print struct diff with a specified outer indent
fn print_struct_diff_with_indent(
    value1: &AnnotatedMoveStruct,
    value2: &AnnotatedMoveStruct,
    indent: u64,
) {
    let indent_str: String = (0..indent).map(|_| " ").collect::<String>();
    let prev_str = format!("{}", value1);
    let new_str = format!("{}", value2);
    let Changeset { diffs, .. } = Changeset::new(&prev_str, &new_str, "\n");
    for diff in diffs {
        match diff {
            Difference::Same(ref x) => {
                let lines = x.split('\n');
                for line in lines {
                    println!(" {}{}", indent_str, line);
                }
            }
            Difference::Add(ref x) => {
                let lines = x.split('\n');
                for line in lines {
                    println!("{}{}{}", "+".green(), indent_str, line.green());
                }
            }
            Difference::Rem(ref x) => {
                let lines = x.split('\n');
                for line in lines {
                    println!("{}{}{}", "-".red(), indent_str, line.red());
                }
            }
        }
    }
}
fn print_struct_diff_with_indent ( value1 : & AnnotatedMoveStruct , value2 : & AnnotatedMoveStruct , indent : u64 , ) { let indent_str : String = ( 0 .. indent ) . map ( | _ | " " ) . collect :: < String > ( ) ; let prev_str = format ! ( " " value1 ) ; let new_str = format ! ( " " value2 ) ; let Changeset { diffs , .. } = Changeset :: new ( & prev_str , & new_str , " \n " ) ; for diff in diffs { match diff { Difference :: Same ( ref x ) => { let lines = x . split ( '\n' ) ; for line in lines { println ! ( " " indent_str line ) ; } } Difference :: Add ( ref x ) => { let lines = x . split ( '\n' ) ; for line in lines { println ! ( " " " " green ( ) indent_str line green ( ) ) ; } } Difference :: Rem ( ref x ) => { let lines = x . split ( '\n' ) ; for line in lines { println ! ( " " " " red ( ) indent_str line red ( ) ) ; } } } } }
Print struct diff with a specified outer indent
Print struct diff with a specified outer indent
value1
&AnnotatedMoveStruct
value2
&AnnotatedMoveStruct
indent
u64