rustmax::axum::serve

Trait Listener

Source
pub trait Listener: Send + 'static {
    type Io: AsyncRead + AsyncWrite + Unpin + Send + 'static;
    type Addr: Send;

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

Types that can listen for connections.

Required Associated Types§

Source

type Io: AsyncRead + AsyncWrite + Unpin + Send + 'static

The listener’s IO type.

Source

type Addr: Send

The listener’s address type.

Required Methods§

Source

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

Accept a new incoming connection to this listener.

If the underlying accept call can return an error, this function must take care of logging and retrying.

Source

fn local_addr(&self) -> Result<Self::Addr, Error>

Returns the local address that this listener is bound to.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§