Trait Acceptor

Source
pub trait Acceptor<S: AsyncRead + AsyncWrite + Send + Unpin + 'static>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn accept<'life0, 'async_trait>(
        &'life0 self,
        stream: S,
        local_addr: SocketAddr,
        remote_addr: SocketAddr,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn protocol(&self) -> Protocol;
}
Expand description

A trait for defining links server acceptors.

For more info about acceptors in general, please see the module-level documentation.

Required Methods§

Source

fn accept<'life0, 'async_trait>( &'life0 self, stream: S, local_addr: SocketAddr, remote_addr: SocketAddr, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Accept an incoming connection in stream from remote_addr to local_addr. This function should spawn a task to handle the request using this acceptor’s associated handler.

Source

fn protocol(&self) -> Protocol

Get the Protocol that this acceptor processes

Implementors§

Source§

impl Acceptor<TcpStream> for PlainHttpAcceptor

Source§

impl Acceptor<TcpStream> for PlainRpcAcceptor

Source§

impl Acceptor<TcpStream> for TlsHttpAcceptor

Source§

impl Acceptor<TcpStream> for TlsRpcAcceptor