pub trait Acceptor: Send {
type Io: AsyncRead + AsyncWrite + Send + Unpin + 'static;
// Required methods
fn local_addr(&self) -> Vec<LocalAddr>;
fn accept(
&mut self
) -> impl Future<Output = IoResult<(Self::Io, LocalAddr, RemoteAddr, Scheme)>> + Send;
}
Available on crate feature
server
only.Expand description
Represents a acceptor type.
Required Associated Types§
Required Methods§
sourcefn local_addr(&self) -> Vec<LocalAddr>
fn local_addr(&self) -> Vec<LocalAddr>
Returns the local address that this listener is bound to.
sourcefn accept(
&mut self
) -> impl Future<Output = IoResult<(Self::Io, LocalAddr, RemoteAddr, Scheme)>> + Send
fn accept( &mut self ) -> impl Future<Output = IoResult<(Self::Io, LocalAddr, RemoteAddr, Scheme)>> + Send
Accepts a new incoming connection from this listener.
This function will yield once a new TCP connection is established. When established, the corresponding IO stream and the remote peer’s address will be returned.
Object Safety§
This trait is not object safe.