pub trait AsyncAcceptable {
type Stream: AsyncRead + AsyncWrite + Unpin + Send + 'static;
// Required method
fn poll_accept(&self, cx: &mut Context<'_>) -> Poll<Result<Self::Stream>>;
// Provided method
fn poll_accept_with_sockaddr(
&self,
cx: &mut Context<'_>,
) -> Poll<Result<(Self::Stream, SocketAddr)>> { ... }
}Expand description
A Listener that can accept connections asynchronously.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn poll_accept_with_sockaddr(
&self,
cx: &mut Context<'_>,
) -> Poll<Result<(Self::Stream, SocketAddr)>>
fn poll_accept_with_sockaddr( &self, cx: &mut Context<'_>, ) -> Poll<Result<(Self::Stream, SocketAddr)>>
Poll accept a connection asynchronously, returning the stream and the peer address.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl AsyncAcceptable for TcpListener
Available on crate feature tokio-net only.
impl AsyncAcceptable for TcpListener
Available on crate feature
tokio-net only.Source§impl AsyncAcceptable for UnixListener
Available on Unix and crate feature tokio-net only.
impl AsyncAcceptable for UnixListener
Available on Unix and crate feature
tokio-net only.