Trait StreamProvider

Source
pub trait StreamProvider {
    type Item: NetworkStream;

    // Required method
    fn connect<A: ToSocketAddrs + Send>(
        addr: A,
    ) -> impl Future<Output = Result<Self::Item, Error>> + Send;
}
Expand description

Provides an abstraction for connect

Required Associated Types§

Source

type Item: NetworkStream

Stream obtained after connect

Required Methods§

Source

fn connect<A: ToSocketAddrs + Send>( addr: A, ) -> impl Future<Output = Result<Self::Item, Error>> + Send

Getting the Stream through a connection, the only difference between this process and tokio::net::TcpStream::connect is that it will be resolved through a customized dns service

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§