via 1.0.1

An async multi-threaded web framework for people who appreciate simplicity.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::error::Error;
use std::future::Future;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::net::TcpStream;

/// A trait for types that can accept a TcpStream.
///
pub trait Acceptor: Clone {
    type Accepted: Future<Output = Result<Self::Stream, Self::Error>> + Send + Sync;
    type Stream: AsyncRead + AsyncWrite + Send + Sync + Unpin;
    type Error: Error + Send + Sync;

    /// Defines how to accept a TcpStream. If the connection is served over TLS,
    /// this is where the TLS handshake would be performed.
    ///
    fn accept(&mut self, stream: TcpStream) -> Self::Accepted;
}