[][src]Function async_native_tls::accept

pub async fn accept<R, S, T>(
    file: R,
    password: S,
    stream: T
) -> Result<TlsStream<T>, AcceptError> where
    R: AsyncRead + Unpin,
    S: AsRef<str>,
    T: AsyncRead + AsyncWrite + Unpin

One of accept of an incoming connection.

Example

use async_std::prelude::*;
use async_std::net::TcpListener;
use async_std::fs::File;

let listener = TcpListener::bind("0.0.0.0:8443").await?;
let (stream, _addr) = listener.accept().await?;

let key = File::open("identity.pfx").await?;
let stream = async_native_tls::accept(key, "<password>", stream).await?;
// handle stream here