pub trait AddressResolver: Send + Sync + 'static {
    type Address: Address;
    type ResolvedAddress: CheapClone + Hash + Eq + Debug + Display + Transformable + Send + Sync + 'static;
    type Error: Error + Send + Sync + 'static;
    type Runtime: RuntimeLite;
    type Options: Send + Sync + 'static;

    // Required methods
    fn new(
        options: Self::Options
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send
       where Self: Sized;
    fn resolve(
        &self,
        address: &Self::Address
    ) -> impl Future<Output = Result<Self::ResolvedAddress, Self::Error>> + Send;
}
Available on crate feature resolver only.
Expand description

Used to resolve a [SocketAddr] from a node address in async style.

Required Associated Types§

source

type Address: Address

The address type used to identify nodes.

source

type ResolvedAddress: CheapClone + Hash + Eq + Debug + Display + Transformable + Send + Sync + 'static

The address type returned by the resolver.

source

type Error: Error + Send + Sync + 'static

The error type returned by the resolver.

source

type Runtime: RuntimeLite

The runtime used to resolve the address.

source

type Options: Send + Sync + 'static

The options type used to configure the resolver.

Required Methods§

source

fn new( options: Self::Options ) -> impl Future<Output = Result<Self, Self::Error>> + Send
where Self: Sized,

Creates a new resolver with the given options.

source

fn resolve( &self, address: &Self::Address ) -> impl Future<Output = Result<Self::ResolvedAddress, Self::Error>> + Send

Resolves the given node address to a [SocketAddr].

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<R: Runtime> AddressResolver for DnsResolver<R>

Available on crate feature dns only.
source§

impl<R: RuntimeLite> AddressResolver for NodeAddressResolver<R>

Available on crate features std and async only.
source§

impl<R: RuntimeLite> AddressResolver for SocketAddrResolver<R>

Available on crate features std and async only.