pub fn equivalent(cs1: &ConfState, cs2: &ConfState) -> Result<(), String> {
    let orig1 = cs1.clone();
    let orig2 = cs2.clone();
    let mut cs1 = cs1.clone();
    let mut cs2 = cs2.clone();
    cs1.voters.sort();
    cs1.learners.sort();
    cs1.voters_outgoing.sort();
    cs1.learners_next.sort();
    if !cs1.get_auto_leave() {
        cs1.set_auto_leave(false);
    }

    cs2.voters.sort();
    cs2.learners.sort();
    cs2.voters_outgoing.sort();
    cs2.learners_next.sort();
    if !cs2.get_auto_leave() {
        cs2.set_auto_leave(false);
    }

    if cs1 != cs2 {
        info!("cs1: {:?}\ncs2:{:?}", cs1, cs2);
        return Err(format!(
            "ConfStates not equivalent after sorting:{:?}\n{:?}\nInputs were:\n{:?}\n{:?}",
            cs1, cs2, orig1, orig2
        ));
    }

    Ok(())
}
// returns a nil error if the inputs describe the same configuration.
// On mismatch, returns a descriptive error showing the difference.
returns a nil error if the inputs describe the same configuration.
On mismatch, returns a descriptive error showing the difference.
returns a nil error if the inputs describe the same configuration . On mismatch returns a descriptive error showing the difference .
pub fn equivalent(cs1: &ConfState, cs2: &ConfState) -> Result<(), String> {
    let orig1 = cs1.clone();
    let orig2 = cs2.clone();
    let mut cs1 = cs1.clone();
    let mut cs2 = cs2.clone();
    cs1.voters.sort();
    cs1.learners.sort();
    cs1.voters_outgoing.sort();
    cs1.learners_next.sort();
    if !cs1.get_auto_leave() {
        cs1.set_auto_leave(false);
    }
    cs2.voters.sort();
    cs2.learners.sort();
    cs2.voters_outgoing.sort();
    cs2.learners_next.sort();
    if !cs2.get_auto_leave() {
        cs2.set_auto_leave(false);
    }
    if cs1 != cs2 {
        info!("cs1: {:?}\ncs2:{:?}", cs1, cs2);
        return Err(format!(
            "ConfStates not equivalent after sorting:{:?}\n{:?}\nInputs were:\n{:?}\n{:?}",
            cs1, cs2, orig1, orig2
        ));
    }
    Ok(())
}
pub fn equivalent ( cs1 : & ConfState , cs2 : & ConfState ) -> Result < ( ) , String > { let orig1 = cs1 . clone ( ) ; let orig2 = cs2 . clone ( ) ; let mut cs1 = cs1 . clone ( ) ; let mut cs2 = cs2 . clone ( ) ; cs1 . voters . sort ( ) ; cs1 . learners . sort ( ) ; cs1 . voters_outgoing . sort ( ) ; cs1 . learners_next . sort ( ) ; if ! cs1 . get_auto_leave ( ) { cs1 . set_auto_leave ( false ) ; } cs2 . voters . sort ( ) ; cs2 . learners . sort ( ) ; cs2 . voters_outgoing . sort ( ) ; cs2 . learners_next . sort ( ) ; if ! cs2 . get_auto_leave ( ) { cs2 . set_auto_leave ( false ) ; } if cs1 != cs2 { info ! ( " \n " cs1 cs2 ) ; return Err ( format ! ( " \n \n \n \n " cs1 cs2 orig1 orig2 ) ) ; } Ok ( ( ) ) }
returns a nil error if the inputs describe the same configuration.
returns a nil error if the inputs describe the same configuration .
cs1
&ConfState
cs2
&ConfState