Trait abstract_ns::HostResolve
[−]
[src]
pub trait HostResolve { type HostFuture: Future<Item = IpList, Error = Error>; fn resolve_host(&self, name: &Name) -> Self::HostFuture; fn frozen_host_subscriber(self) -> FrozenSubscriber<Self>
where
Self: Sized, { ... } fn null_service_resolver(self) -> NullResolver<Self>
where
Self: Sized, { ... } }
Resolves a hostname into a list of IpAddresses
This is usually equivalent of the resolving A or AAAA record. This kind of resolution is used in two cases:
- If user specified port of the service explicitly (
example.org:1234
) - When there is known default port like
80
for http
Note: akin to A records this method returns plain list of addresses so
it can't use a backup addresses and weights. So this should be used for
simple cases and full blown Resolve
trait (i.e. SRV records) for
more complex ones.
Associated Types
type HostFuture: Future<Item = IpList, Error = Error>
A future returned from resolve()
Required Methods
fn resolve_host(&self, name: &Name) -> Self::HostFuture
Resolve a name to an address once
Provided Methods
fn frozen_host_subscriber(self) -> FrozenSubscriber<Self> where
Self: Sized,
Self: Sized,
Create a subscriber that resolves once using this resolver and never updates a stream
This is mostly useful for tests
fn null_service_resolver(self) -> NullResolver<Self> where
Self: Sized,
Self: Sized,
Create a thing that implements Resolve+HostResolve but returns
NameNotFound
on resolve
This is needed to add resolver that can only resolve hostnames to the router.
Implementations on Foreign Types
impl<T: HostResolve> HostResolve for Arc<T>
[src]
type HostFuture = T::HostFuture
fn resolve_host(&self, name: &Name) -> Self::HostFuture
[src]
fn frozen_host_subscriber(self) -> FrozenSubscriber<Self> where
Self: Sized,
[src]
Self: Sized,
fn null_service_resolver(self) -> NullResolver<Self> where
Self: Sized,
[src]
Self: Sized,
Implementors
impl<R: HostResolve> HostResolve for NullResolver<R> type HostFuture = R::HostFuture;
impl<R> HostResolve for NullHostResolver<R> type HostFuture = FutureResult<IpList, Error>;
impl<R: HostResolve> HostResolve for FrozenSubscriber<R> type HostFuture = R::HostFuture;