Trait MakeConnection

Source
pub trait MakeConnection<Target>: Sealed<(Target,)> {
    type Connection: AsyncRead + AsyncWrite;
    type Error;

    // Required method
    fn make_connection(
        &self,
        target: Target,
    ) -> impl Future<Output = Result<Self::Connection, Self::Error>>;
}
Available on crate feature make only.
Expand description

The MakeConnection trait is used to create transports.

The goal of this service is to allow composable methods for creating AsyncRead + AsyncWrite transports. This could mean creating a TLS based connection or using some other method to authenticate the connection.

Required Associated Types§

Source

type Connection: AsyncRead + AsyncWrite

The transport provided by this service

Source

type Error

Errors produced by the connecting service

Required Methods§

Source

fn make_connection( &self, target: Target, ) -> impl Future<Output = Result<Self::Connection, Self::Error>>

Connect and return a transport asynchronously

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§

Source§

impl<C, Target> MakeConnection<Target> for C
where C: Service<Target>, C::Response: AsyncRead + AsyncWrite,

Source§

type Connection = <C as Service<Target>>::Response

Source§

type Error = <C as Service<Target>>::Error