Skip to main content

TlsConnector

Trait TlsConnector 

Source
pub trait TlsConnector:
    Send
    + Sync
    + 'static {
    // Required method
    fn connect(
        &self,
        stream: TlsStream,
        server_name: ServerName<'static>,
    ) -> Pin<Box<dyn Future<Output = Result<TlsStream, TlsError>> + Send + '_>>;
}
Expand description

Types that can establish outbound TLS connections.

Implementations wrap a transport-layer stream in a TLS client handshake, producing a TlsStream on success. The trait is object-safe: it can be used through Box<dyn TlsConnector> or Arc<dyn TlsConnector>.

Required Methods§

Source

fn connect( &self, stream: TlsStream, server_name: ServerName<'static>, ) -> Pin<Box<dyn Future<Output = Result<TlsStream, TlsError>> + Send + '_>>

Perform the TLS client handshake over stream, using server_name for SNI and certificate verification.

Returns the wrapped TlsStream on success, or a TlsError on failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§