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§
Sourcetype TcpStream: AsyncRead + AsyncWrite + Unpin + 'static
type TcpStream: AsyncRead + AsyncWrite + Unpin + 'static
The TCP stream type that this listener produces.
Required Methods§
Sourcefn 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 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.
Sourcefn local_addr(&self) -> Result<String, Error>
fn local_addr(&self) -> Result<String, Error>
Get the local address this listener is bound to.