pub trait ExternalConnections:
Clone
+ Send
+ Sync
+ 'static {
type Socket: Unpin + Send + Sync + 'static;
type ListenerType: Listener<Self::Socket> + Send + Sync;
// Required methods
fn bind(
&self,
addr: SocketAddr,
) -> BoxFuture<'static, ConnectionResult<(SocketAddr, Self::ListenerType)>>;
fn try_open(
&self,
scheme: Scheme,
host: Option<&str>,
addr: SocketAddr,
) -> BoxFuture<'_, ConnectionResult<Self::Socket>>;
fn dns_resolver(&self) -> BoxDnsResolver;
fn lookup(
&self,
host: String,
port: u16,
) -> BoxFuture<'static, Result<Vec<SocketAddr>>>;
}Expand description
Trait for types that can create remote network connections asynchronously. This is primarily used to abstract over ordinary sockets and sockets with TLS support.
Required Associated Types§
type Socket: Unpin + Send + Sync + 'static
type ListenerType: Listener<Self::Socket> + Send + Sync
Required Methods§
fn bind( &self, addr: SocketAddr, ) -> BoxFuture<'static, ConnectionResult<(SocketAddr, Self::ListenerType)>>
fn try_open( &self, scheme: Scheme, host: Option<&str>, addr: SocketAddr, ) -> BoxFuture<'_, ConnectionResult<Self::Socket>>
fn dns_resolver(&self) -> BoxDnsResolver
fn lookup( &self, host: String, port: u16, ) -> BoxFuture<'static, Result<Vec<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.