Skip to main content

ConnectionProvider

Trait ConnectionProvider 

pub trait ConnectionProvider:
    'static
    + Clone
    + Send
    + Sync
    + Unpin {
    type Conn: DnsHandle + Clone + Send + Sync + 'static;
    type FutureConn: Future<Output = Result<Self::Conn, NetError>> + Send + 'static;
    type RuntimeProvider: RuntimeProvider;

    // Required methods
    fn new_connection(
        &self,
        ip: IpAddr,
        config: &ConnectionConfig,
        cx: &PoolContext,
    ) -> Result<Self::FutureConn, NetError>;
    fn runtime_provider(&self) -> &Self::RuntimeProvider;
}
Expand description

Create DnsHandle with the help of RuntimeProvider. This trait is designed for customization.

Required Associated Types§

type Conn: DnsHandle + Clone + Send + Sync + 'static

The handle to the connection for sending DNS requests.

type FutureConn: Future<Output = Result<Self::Conn, NetError>> + Send + 'static

Ths future is responsible for spawning any background tasks as necessary.

type RuntimeProvider: RuntimeProvider

Provider that handles the underlying I/O and timing.

Required Methods§

fn new_connection( &self, ip: IpAddr, config: &ConnectionConfig, cx: &PoolContext, ) -> Result<Self::FutureConn, NetError>

Create a new connection.

fn runtime_provider(&self) -> &Self::RuntimeProvider

Get a reference to a RuntimeProvider.

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§