pub trait MayBeTls: Unpin + AsyncRead + AsyncWrite + Sync + Send {
    fn enable_encryption(
        &mut self,
        upgrade: Box<dyn TlsUpgrade + 'static, Global>,
        name: String
    );
fn encrypt(self: Pin<&mut Self>);
fn can_encrypt(&self) -> bool;
fn is_encrypted(&self) -> bool; }
Expand description

A stream implementing this trait may be able to upgrade to TLS But maybe not…

Required methods

Initiates the TLS negotiations. The stream must then block all reads/writes until the underlying TLS handshake is done. If it is not possible to encrypt and subsequent reads/writes must fail.

Returns true only if calling encrypt would make sense:

  1. required encryption setup information is available.
  2. the stream is not encrypted yet.

Returns true if the stream is already encrypted.

Implementors