Trait StreamUpgrade

Source
pub trait StreamUpgrade: Stream + Sized {
    // Required methods
    fn secure_upgrade(
        self,
    ) -> impl Future<Output = Result<Self, SslError>> + Send;
    fn secure_upgrade_preview(
        self,
        options: PreviewConfiguration,
    ) -> impl Future<Output = Result<(Preview, Self), SslError>> + Send;
    fn handshake(&self) -> Option<&TlsHandshake>;
}
Expand description

A trait for streams that can be upgraded to a TLS stream.

Required Methods§

Source

fn secure_upgrade(self) -> impl Future<Output = Result<Self, SslError>> + Send

Upgrade the stream to a TLS stream.

Source

fn secure_upgrade_preview( self, options: PreviewConfiguration, ) -> impl Future<Output = Result<(Preview, Self), SslError>> + Send

Upgrade the stream to a TLS stream, and preview the initial bytes.

Source

fn handshake(&self) -> Option<&TlsHandshake>

Get the TLS handshake information, if the stream is upgraded.

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<S: Stream, D: TlsDriver> StreamUpgrade for UpgradableStream<S, D>