Trait Accept

Source
pub trait Accept<I, S> {
    type Stream;
    type Service;
    type Future: Future<Output = Result<(Self::Stream, Self::Service)>>;

    // Required method
    fn accept(&self, stream: I, service: S) -> Self::Future;
}
Expand description

An asynchronous trait for processing and modifying IO streams and services.

Implementations of this trait can be used to modify or transform the input stream and service before further processing. For instance, this trait could be used to perform initial authentication, logging, or other setup operations on new connections.

Required Associated Types§

Source

type Stream

The modified or transformed IO stream produced by accept.

Source

type Service

The modified or transformed service produced by accept.

Source

type Future: Future<Output = Result<(Self::Stream, Self::Service)>>

The Future type that is returned by accept.

Required Methods§

Source

fn accept(&self, stream: I, service: S) -> Self::Future

Asynchronously process and possibly modify the given IO stream and service.

§Parameters:
  • stream: The incoming IO stream, typically a connection.
  • service: The associated service with the stream.
§Returns:

A future resolving to the modified stream and service, or an error.

Implementors§

Source§

impl<A, I, S> Accept<I, S> for ProxyProtocolAcceptor<A>
where A: Accept<I, S> + Clone, A::Stream: AsyncRead + AsyncWrite + Unpin, I: AsyncRead + AsyncWrite + Unpin + Send + 'static,

Available on crate feature proxy_protocol only.
Source§

type Stream = <A as Accept<I, S>>::Stream

Source§

type Service = ForwardClientIp<<A as Accept<I, S>>::Service>

Source§

type Future = ProxyProtocolAcceptorFuture<Pin<Box<dyn Future<Output = Result<(I, Option<SocketAddr>), Error>> + Send>>, A, I, S>

Source§

impl<A, I, S> Accept<I, S> for OpenSSLAcceptor<A>
where A: Accept<I, S>, A::Stream: AsyncRead + AsyncWrite + Unpin,

Available on crate feature tls-openssl only.
Source§

type Stream = SslStream<<A as Accept<I, S>>::Stream>

Source§

type Service = <A as Accept<I, S>>::Service

Source§

type Future = OpenSSLAcceptorFuture<<A as Accept<I, S>>::Future, <A as Accept<I, S>>::Stream, <A as Accept<I, S>>::Service>

Source§

impl<A, I, S> Accept<I, S> for RustlsAcceptor<A>
where A: Accept<I, S>, A::Stream: AsyncRead + AsyncWrite + Unpin,

Available on crate feature tls-rustls only.
Source§

type Stream = TlsStream<<A as Accept<I, S>>::Stream>

Source§

type Service = <A as Accept<I, S>>::Service

Source§

type Future = RustlsAcceptorFuture<<A as Accept<I, S>>::Future, <A as Accept<I, S>>::Stream, <A as Accept<I, S>>::Service>

Source§

impl<I, S> Accept<I, S> for DefaultAcceptor