pub fn compare_addresses(&self, other: &WeightedSet)
        -> (Vec<SocketAddr>, Vec<SocketAddr>)
    {
        // TODO(tailhook) a very naive implementation, optimize
        let mut old = Vec::new();
        let mut new = Vec::new();
        for &(_, a) in self.addresses {
            if !other.addresses.iter().find(|&&(_, a1)| a == a1).is_some() {
                old.push(a);
            }
        }
        for &(_, a) in other.addresses {
            if !self.addresses.iter().find(|&&(_, a1)| a == a1).is_some() {
                new.push(a);
            }
        }
        return (old, new);
    }
/// Compares two weighted sets to find out which addresses have been
/// removed from set or added
///
/// This doesn't compare weights of the addresses
Compares two weighted sets to find out which addresses have been
removed from set or added

This doesn't compare weights of the addresses
Compares two weighted sets to find out which addresses have been removed from set or added This doesn ' t compare weights of the addresses
pub fn compare_addresses(&self, other: &WeightedSet)
        -> (Vec<SocketAddr>, Vec<SocketAddr>)
    {
        // TODO(tailhook) a very naive implementation, optimize
        let mut old = Vec::new();
        let mut new = Vec::new();
        for &(_, a) in self.addresses {
            if !other.addresses.iter().find(|&&(_, a1)| a == a1).is_some() {
                old.push(a);
            }
        }
        for &(_, a) in other.addresses {
            if !self.addresses.iter().find(|&&(_, a1)| a == a1).is_some() {
                new.push(a);
            }
        }
        return (old, new);
    }
pub fn compare_addresses ( & self , other : & WeightedSet ) -> ( Vec < SocketAddr > , Vec < SocketAddr > ) { // TODO(tailhook) a very naive implementation, optimize let mut old = Vec :: new ( ) ; let mut new = Vec :: new ( ) ; for & ( _ , a ) in self . addresses { if ! other . addresses . iter ( ) . find ( | & & ( _ , a1 ) | a == a1 ) . is_some ( ) { old . push ( a ) ; } } for & ( _ , a ) in other . addresses { if ! self . addresses . iter ( ) . find ( | & & ( _ , a1 ) | a == a1 ) . is_some ( ) { new . push ( a ) ; } } return ( old , new ) ; }
Compares two weighted sets to find out which addresses have been
removed from set or added
Compares two weighted sets to find out which addresses have been removed from set or added
&self
other
&WeightedSet
&self
other
&WeightedSet