// If there has been a state change, saves the previous state and returns true.
// If there was no change, restores state time and return false.
If there has been a state change, saves the previous state and returns true.
If there was no change, restores state time and return false.
If there has been a state change saves the previous state and returns true . If there was no change restores state time and return false .
fn fix_state_on_change(old: &NetworkInfo, new: &mut NetworkInfo) -> bool {
    if old.state == new.state {
        // Keep the old time as state did not change.
        new.state.time = old.state.time;
        new.previous_state = old.previous_state;
        return false;
    }
    new.previous_state = old.state;
    true
}
fn fix_state_on_change ( old : & NetworkInfo , new : & mut NetworkInfo ) -> bool { if old . state == new . state { // Keep the old time as state did not change. new . state . time = old . state . time ; new . previous_state = old . previous_state ; return false ; } new . previous_state = old . state ; true }
If there has been a state change, saves the previous state and returns true.
If there has been a state change saves the previous state and returns true .
old
&NetworkInfo
new
&mut NetworkInfo