pub trait ConnectionProvider:
'static
+ Clone
+ Send
+ Sync
+ Unpin {
type Conn: DnsHandle<Error = ResolveError> + Clone + Send + Sync + 'static;
type FutureConn: Future<Output = Result<Self::Conn, ResolveError>> + Send + 'static;
type Time: Time;
// Required method
fn new_connection(
&self,
config: &NameServerConfig,
options: &ResolverOpts,
) -> Self::FutureConn;
}Expand description
A type to allow for custom ConnectionProviders. Needed mainly for mocking purposes.
ConnectionProvider is responsible for spawning any background tasks as necessary.
Required Associated Types§
Sourcetype Conn: DnsHandle<Error = ResolveError> + Clone + Send + Sync + 'static
type Conn: DnsHandle<Error = ResolveError> + Clone + Send + Sync + 'static
The handle to the connect for sending DNS requests.
Sourcetype FutureConn: Future<Output = Result<Self::Conn, ResolveError>> + Send + 'static
type FutureConn: Future<Output = Result<Self::Conn, ResolveError>> + Send + 'static
Ths future is responsible for spawning any background tasks as necessary
Required Methods§
Sourcefn new_connection(
&self,
config: &NameServerConfig,
options: &ResolverOpts,
) -> Self::FutureConn
fn new_connection( &self, config: &NameServerConfig, options: &ResolverOpts, ) -> Self::FutureConn
The returned handle should
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.