Trait Listener
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§
Required Methods§
fn 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.
fn local_addr(&self) -> Result<Self::Addr, Error>
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".