TcpListenerTrait

Trait TcpListenerTrait 

Source
pub trait TcpListenerTrait {
    type TcpStream: AsyncRead + AsyncWrite + Unpin + 'static;

    // Required methods
    fn accept<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(Self::TcpStream, String), Error>> + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn local_addr(&self) -> Result<String, Error>;
}
Expand description

Trait for TCP listeners that can accept connections.

Required Associated Types§

Source

type TcpStream: AsyncRead + AsyncWrite + Unpin + 'static

The TCP stream type that this listener produces.

Required Methods§

Source

fn accept<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(Self::TcpStream, String), Error>> + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Accept a single incoming connection.

Source

fn local_addr(&self) -> Result<String, Error>

Get the local address this listener is bound to.

Implementors§