Skip to main content

TcpConnector

Trait TcpConnector 

Source
pub trait TcpConnector: Send + Sync {
    type Stream: AsyncRead + AsyncWrite + Send + Unpin + 'static;

    // Required method
    fn connect(
        &self,
        addr: &str,
    ) -> impl Future<Output = Result<Self::Stream>> + Send;
}
Expand description

Trait for network types that can establish TCP connections.

Required Associated Types§

Source

type Stream: AsyncRead + AsyncWrite + Send + Unpin + 'static

Required Methods§

Source

fn connect( &self, addr: &str, ) -> impl Future<Output = Result<Self::Stream>> + Send

Connect to the specified address.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§