Struct abstract_ns::Address
[−]
[src]
pub struct Address(_);
Address that nameservice has returned
We hide this structure to allow future additions. There is AddressBuilder
which provides a forward compatible way to build such address in a resolver
and there are methods to extract data from it.
Internally it's an Arc
over a structure so it's cheap to clone and you
can cache addresses.
Methods
impl Address
[src]
fn pick_one(&self) -> Option<SocketAddr>
Select one random address to connect to
Picks a single address from the set of high priority addresses, with the random distribution according to the weights.
This method is stateless so it can't find out that high priority addresses are all inaccessible and fallback addresses should be used.
Returns None
if address is empty
fn at(&self, priority: usize) -> WeightedSet
Returns the set of the hosts for the same priority
Note: original priorities are lost. This method has contiguous array
of sets of hosts. The highest priority hosts returned by .at(0)
.
If no hosts the priority exists returns an empty set
Use iter()
to iterate over WeightedSet
's by priority
fn iter(&self) -> PriorityIter
Returns iterator over WeightedSet
's starting from high priority set
Trait Implementations
impl Clone for Address
[src]
fn clone(&self) -> Address
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Address
[src]
impl From<(IpAddr, u16)> for Address
[src]
impl FromIterator<SocketAddr> for Address
[src]
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=SocketAddr>
Creates a value from an iterator. Read more