Skip to main content

TransportListener

Trait TransportListener 

Source
pub trait TransportListener: Send + Sync {
    // Required methods
    fn accept(
        &mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(BoxedStream, SocketAddr), Error>> + Send + '_>>;
    fn local_addr(&self) -> Result<SocketAddr, Error>;
}
Expand description

An object-safe listener that accepts inbound connections.

Implemented by TokioListener for real TCP sockets; simulation backends provide their own implementation backed by in-memory channels.

The accept method returns a boxed future for dyn compatibility.

Required Methods§

Source

fn accept( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(BoxedStream, SocketAddr), Error>> + Send + '_>>

Accept the next inbound connection.

Source

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

Return the local address this listener is bound to.

§Errors

Returns an error if the session is shut down.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§