pub trait Listener: Send + 'static {
type Io: AsyncRead + AsyncWrite + Unpin + Send + 'static;
type Addr: Clone + Send + Sync + 'static;
// Required methods
fn accept(&mut self) -> impl Future<Output = (Self::Io, Self::Addr)> + Send;
fn local_addr(&self) -> Result<Self::Addr>;
}Expand description
Types that can listen for connections.
Required Associated Types§
Required Methods§
Sourcefn accept(&mut self) -> impl Future<Output = (Self::Io, Self::Addr)> + Send
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.
Sourcefn local_addr(&self) -> Result<Self::Addr>
fn local_addr(&self) -> Result<Self::Addr>
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".