Trait tower::make::MakeConnection

source ·
pub trait MakeConnection<Target>: Sealed<(Target,)> {
    type Connection: AsyncRead + AsyncWrite;
    type Error;
    type Future: Future<Output = Result<Self::Connection, Self::Error>>;

    // Required methods
    fn poll_ready(
        &mut self,
        cx: &mut Context<'_>
    ) -> Poll<Result<(), Self::Error>>;
    fn make_connection(&mut self, target: Target) -> Self::Future;
}
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

source

type Future: Future<Output = Result<Self::Connection, Self::Error>>

The future that eventually produces the transport

Required Methods§

source

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when it is able to make more connections.

source

fn make_connection(&mut self, target: Target) -> Self::Future

Connect and return a transport asynchronously

Implementors§

source§

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

§

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

§

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

§

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