AsyncTls

Trait AsyncTls 

Source
pub trait AsyncTls<C: AsyncRead + AsyncWrite>: Clone {
    type Stream;
    type Error: Error;
    type AcceptFuture: Future<Output = Result<Self::Stream, Self::Error>>;

    // Required method
    fn accept(&self, stream: C) -> Self::AcceptFuture;
}
Expand description

Trait for TLS implementation.

Implementations are provided by the rustls and native-tls features.

Required Associated Types§

Source

type Stream

The type of the TLS stream created from the underlying stream.

Source

type Error: Error

Error type for completing the TLS handshake

Source

type AcceptFuture: Future<Output = Result<Self::Stream, Self::Error>>

Type of the Future for the TLS stream that is accepted.

Required Methods§

Source

fn accept(&self, stream: C) -> Self::AcceptFuture

Accept a TLS connection on an underlying stream

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.

Implementations on Foreign Types§

Source§

impl<C> AsyncTls<C> for SslContext
where C: AsyncRead + AsyncWrite + Unpin + Send + 'static,

Available on crate feature openssl only.
Source§

type Stream = SslStream<C>

Source§

type Error = Error

Source§

type AcceptFuture = Pin<Box<dyn Future<Output = Result<<SslContext as AsyncTls<C>>::Stream, <SslContext as AsyncTls<C>>::Error>> + Send>>

Source§

fn accept(&self, conn: C) -> Self::AcceptFuture

Source§

impl<C> AsyncTls<C> for TlsAcceptor
where C: AsyncRead + AsyncWrite + Unpin + Send + 'static,

Available on crate feature native-tls only.
Source§

impl<C: AsyncRead + AsyncWrite + Unpin> AsyncTls<C> for TlsAcceptor

Available on crate feature rustls-core only.

Implementors§

Source§

impl<C, T> AsyncTls<C> for SpawningHandshakes<T>
where T: AsyncTls<C>, C: AsyncRead + AsyncWrite, T::AcceptFuture: Send + 'static, T::Stream: Send + 'static, T::Error: Send + 'static,

Available on crate feature rt only.
Source§

type Stream = <T as AsyncTls<C>>::Stream

Source§

type Error = <T as AsyncTls<C>>::Error

Source§

type AcceptFuture = HandshakeJoin<<T as AsyncTls<C>>::Stream, <T as AsyncTls<C>>::Error>