Struct abstract_ns::WeightedSet
[−]
[src]
pub struct WeightedSet<'a> { /* fields omitted */ }
A structure that represents a set of addresses of the same priority
Methods
impl<'a> WeightedSet<'a>
[src]
fn pick_one(&self) -> Option<SocketAddr>
Select one random address to connect to
This function selects a host according to the random distribution according to the weights.
Returns None
if the set is empty
fn addresses(&self) -> AddressIter
Returns iterator over underlying addresses
This effectively discards weights, but may be useful for cases where
you treat addresses as a set. For example to find out whether two
Address
values intersect over SocketAddr
.
fn compare_addresses(
&self,
other: &WeightedSet
) -> (Vec<SocketAddr>, Vec<SocketAddr>)
&self,
other: &WeightedSet
) -> (Vec<SocketAddr>, Vec<SocketAddr>)
Compares two weighted sets to find out which addresses have been removed from set or added
This doesn't compare weights of the addresses