Skip to main content

StreamConnector

Trait StreamConnector 

Source
pub trait StreamConnector: Debug {
    type Stream: AsyncRead + AsyncWrite + Send + Unpin + 'static;

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

An async handshake that provides an AsyndRead/AsyncWrite stream.

You could consider wrapping these if you need to hook stream connection, or of course you can implement your own connector for your own stream type.

Required Associated Types§

Source

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

The type of stream this connector will produce

Required Methods§

Source

fn connect_stream( &self, stream: TcpStream, ) -> impl Future<Output = Result<Self::Stream>> + Send

Take a TCP stream and turn it into a new Stream type.

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§