fn update_on_change(&mut self, id: Id, new: &mut ReachabilityInfo) -> HashSet<Proto> {
        let mut updated = HashSet::new();
        match self.0.get(&id) {
            Some(old) => {
                if fix_state_on_change(&old.get(Proto::IPv4), new.get_mut(Proto::IPv4)) {
                    updated.insert(Proto::IPv4);
                }
                if fix_state_on_change(&old.get(Proto::IPv6), new.get_mut(Proto::IPv6)) {
                    updated.insert(Proto::IPv6);
                }
                if !updated.is_empty() {
                    // Something changed, update.
                    self.0.insert(id, new.clone());
                }
            }
            None => {
                self.0.insert(id, new.clone());
                updated.insert(Proto::IPv4);
                updated.insert(Proto::IPv6);
            }
        };
        updated
    }
/// Updates the reachability info associated with an interface if it has changed.
/// Returns a set with the IP version that had reachability state change.
Updates the reachability info associated with an interface if it has changed.
Returns a set with the IP version that had reachability state change.
Updates the reachability info associated with an interface if it has changed . Returns a set with the IP version that had reachability state change .
fn update_on_change(&mut self, id: Id, new: &mut ReachabilityInfo) -> HashSet<Proto> {
        let mut updated = HashSet::new();
        match self.0.get(&id) {
            Some(old) => {
                if fix_state_on_change(&old.get(Proto::IPv4), new.get_mut(Proto::IPv4)) {
                    updated.insert(Proto::IPv4);
                }
                if fix_state_on_change(&old.get(Proto::IPv6), new.get_mut(Proto::IPv6)) {
                    updated.insert(Proto::IPv6);
                }
                if !updated.is_empty() {
                    // Something changed, update.
                    self.0.insert(id, new.clone());
                }
            }
            None => {
                self.0.insert(id, new.clone());
                updated.insert(Proto::IPv4);
                updated.insert(Proto::IPv6);
            }
        };
        updated
    }
fn update_on_change ( & mut self , id : Id , new : & mut ReachabilityInfo ) -> HashSet < Proto > { let mut updated = HashSet :: new ( ) ; match self . 0 . get ( & id ) { Some ( old ) => { if fix_state_on_change ( & old . get ( Proto :: IPv4 ) , new . get_mut ( Proto :: IPv4 ) ) { updated . insert ( Proto :: IPv4 ) ; } if fix_state_on_change ( & old . get ( Proto :: IPv6 ) , new . get_mut ( Proto :: IPv6 ) ) { updated . insert ( Proto :: IPv6 ) ; } if ! updated . is_empty ( ) { // Something changed, update. self . 0 . insert ( id , new . clone ( ) ) ; } } None => { self . 0 . insert ( id , new . clone ( ) ) ; updated . insert ( Proto :: IPv4 ) ; updated . insert ( Proto :: IPv6 ) ; } } ; updated }
Updates the reachability info associated with an interface if it has changed.
Updates the reachability info associated with an interface if it has changed .
&mut self
id
Id
new
&mut ReachabilityInfo
&mut self
id
Id
new
&mut ReachabilityInfo