pub struct FoundHosts<R: Resolver> { /* private fields */ }
Expand description
The value returned by a successful host lookup.
You can use the iter()
method to get an iterator over the IP addresses
or port_iter()
to get an iterator over socket addresses with the given
port.
The canonical_name()
method returns the canonical name of the host for
which the addresses were found.
Implementations§
source§impl<R: Resolver> FoundHosts<R>
impl<R: Resolver> FoundHosts<R>
source§impl<R: Resolver> FoundHosts<R>
impl<R: Resolver> FoundHosts<R>
pub fn qname(&self) -> ParsedDname<<R::Octets as Octets>::Range<'_>>
sourcepub fn canonical_name(&self) -> ParsedDname<<R::Octets as Octets>::Range<'_>>
pub fn canonical_name(&self) -> ParsedDname<<R::Octets as Octets>::Range<'_>>
Returns a reference to the canonical name for the host.
§Notes
This method expects the canonical name to be same in both A/AAAA responses, if it isn’t, it’s going to return a canonical name for one of them.
sourcepub fn iter(&self) -> FoundHostsIter<'_> ⓘ
pub fn iter(&self) -> FoundHostsIter<'_> ⓘ
Returns an iterator over the IP addresses returned by the lookup.
sourcepub fn port_iter(&self, port: u16) -> FoundHostsSocketIter<'_> ⓘ
pub fn port_iter(&self, port: u16) -> FoundHostsSocketIter<'_> ⓘ
Returns an iterator over socket addresses gained from the lookup.
The socket addresses are gained by combining the IP addresses with
port
. The returned iterator implements ToSocketAddrs
and thus
can be used where std::net
wants addresses right away.