Trait TcpStreamConnector
pub trait TcpStreamConnector:
Clone
+ Send
+ Sync
+ 'static {
type Error;
// Required method
fn connect(
&self,
addr: SocketAddr,
) -> impl Future<Output = Result<TcpStream, Self::Error>> + Send;
}Available on crate feature
tcp only.Expand description
Trait used internally by tcp_connect and the TcpConnector
to actually establish the [TcpStream.]
Required Associated Types§
type Error
type Error
Type of error that can occurr when establishing the connection failed.
Required Methods§
fn connect(
&self,
addr: SocketAddr,
) -> impl Future<Output = Result<TcpStream, Self::Error>> + Send
fn connect( &self, addr: SocketAddr, ) -> impl Future<Output = Result<TcpStream, Self::Error>> + Send
Connect to the target via the given SocketAddress to establish a TcpStream.
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.
Implementations on Foreign Types§
§impl TcpStreamConnector for ()
impl TcpStreamConnector for ()
§impl TcpStreamConnector for Arc<SocketOptions>
impl TcpStreamConnector for Arc<SocketOptions>
type Error = OpaqueError
async fn connect( &self, addr: SocketAddr, ) -> Result<TcpStream, <Arc<SocketOptions> as TcpStreamConnector>::Error>
§impl<T> TcpStreamConnector for Arc<T>where
T: TcpStreamConnector,
impl<T> TcpStreamConnector for Arc<T>where
T: TcpStreamConnector,
type Error = <T as TcpStreamConnector>::Error
fn connect( &self, addr: SocketAddr, ) -> impl Future<Output = Result<TcpStream, <Arc<T> as TcpStreamConnector>::Error>> + Send
Implementors§
§impl TcpStreamConnector for SocketAddress
impl TcpStreamConnector for SocketAddress
type Error = OpaqueError
§impl TcpStreamConnector for DeviceName
Available on Android or Fuchsia or Linux only.
impl TcpStreamConnector for DeviceName
Available on Android or Fuchsia or Linux only.