logo
pub trait Listener: Send {
    type Acceptor: Acceptor;
    fn into_acceptor<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = IoResult<Self::Acceptor>> + Send + 'async_trait>>
    where
        Self: 'async_trait
; fn combine<T>(self, other: T) -> Combined<Self, T>
    where
        Self: Sized
, { ... }
fn rustls<S: IntoTlsConfigStream<RustlsConfig>>(
        self,
        config_stream: S
    ) -> RustlsListener<Self, S>
    where
        Self: Sized
, { ... }
fn native_tls<S: IntoTlsConfigStream<NativeTlsConfig>>(
        self,
        config_stream: S
    ) -> NativeTlsListener<Self, S>
    where
        Self: Sized
, { ... } }
Expand description

Represents a listener that can be listens for incoming connections.

Associated Types

The acceptor type.

Required methods

Create a acceptor instance.

Provided methods

Combine two listeners.

You can call this function multiple times to combine more listeners.

Example
use poem::listener::{Listener, TcpListener};

let listener = TcpListener::bind("127.0.0.1:80").combine(TcpListener::bind("127.0.0.1:81"));
This is supported on crate feature rustls only.

Consume this listener and return a new TLS listener with rustls.

This is supported on crate feature native-tls only.

Consume this listener and return a new TLS listener with native-tls.

Implementations on Foreign Types

Implementors