Trait Acceptor

pub trait Acceptor:
    Send
    + Sync
    + 'static {
    type Stream: Stream;

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

Acceptor created by an [AcceptorFactory] in function of a Binder.

Required Associated Types§

type Stream: Stream

The Stream returned by this Acceptor.

Required Methods§

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

Returns the local address that this listener is bound to.

fn accept( self, ) -> impl Future<Output = Result<(Self::Stream, SocketAddress), Error>> + Send

Returns the first succesfully accepted connection.

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§