Trait Resolve

Source
pub trait Resolve {
    type Future: Future<Item = Address, Error = Error>;

    // Required method
    fn resolve(&self, name: &Name) -> Self::Future;

    // Provided methods
    fn frozen_subscriber(self) -> FrozenSubscriber<Self>
       where Self: Resolve + Sized { ... }
    fn frozen_service_subscriber(self) -> FrozenSubscriber<Self>
       where Self: Sized { ... }
    fn null_host_resolver(self) -> NullHostResolver<Self>
       where Self: Sized { ... }
}
Expand description

Resolves a name of the service in to a set of addresses

This is commonly done using SRV records, but can also be done as a wrapper around resolver by resolving a host and adding a default value (see HostResolve::with_default_port.

Required Associated Types§

Source

type Future: Future<Item = Address, Error = Error>

A future returned from resolve()

Required Methods§

Source

fn resolve(&self, name: &Name) -> Self::Future

Resolve a name to an address once

Provided Methods§

Source

fn frozen_subscriber(self) -> FrozenSubscriber<Self>
where Self: Resolve + Sized,

Create a subscriber that resolves once using this resolver and never updates a stream

This is mostly useful for tests

Source

fn frozen_service_subscriber(self) -> FrozenSubscriber<Self>
where Self: Sized,

Create a subscriber that resolves once using this resolver and never updates a stream

This is mostly useful for tests

Source

fn null_host_resolver(self) -> NullHostResolver<Self>
where Self: Sized,

Create a thing that implements Resolve+HostResolve but returns NameNotFound on resolve_host

This is needed to add resolver that can only resolve services to the router.

Implementations on Foreign Types§

Source§

impl<T: Resolve> Resolve for Arc<T>

Source§

type Future = <T as Resolve>::Future

Source§

fn resolve(&self, name: &Name) -> Self::Future

Implementors§