Skip to main content

Listener

Trait Listener 

Source
pub trait Listener {
    type Io: Read + Write + Unpin + Send + 'static;
    type Error;

    // Required method
    fn accept(
        &mut self,
    ) -> impl Future<Output = Result<Self::Io, Self::Error>> + Send;
}
Expand description

An abstract async listener for incoming network connections.

Implementations of this trait allow OmahaServer to bind and accept socket connections without depending on a specific async TCP stream implementation.

Required Associated Types§

Source

type Io: Read + Write + Unpin + Send + 'static

The async I/O stream type that implements Hyper’s Read and Write traits.

Source

type Error

The error type returned when accepting connections.

Required Methods§

Source

fn accept( &mut self, ) -> impl Future<Output = Result<Self::Io, Self::Error>> + Send

Accepts an incoming connection asynchronously.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Listener for TcpListener

Available on crate feature tokio only.
Source§

type Io = TokioIo<TcpStream>

Source§

type Error = Error

Source§

async fn accept( &mut self, ) -> Result<<TcpListener as Listener>::Io, <TcpListener as Listener>::Error>

Implementors§