Trait AddressResolver

Source
pub trait AddressResolver:
    Send
    + Sync
    + 'static {
    type Address: Address;
    type ResolvedAddress: CheapClone + Hash + Eq + Ord + Debug + Display + 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 + Ord + Debug + Display + 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].

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§