Trait tokio_util::net::Listener
source · [−]pub trait Listener {
type Io: AsyncRead + AsyncWrite;
type Addr;
fn poll_accept(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(Self::Io, Self::Addr)>>;
fn local_addr(&self) -> Result<Self::Addr>;
fn accept(&mut self) -> ListenerAcceptFut<'_, Self>ⓘNotable traits for ListenerAcceptFut<'a, L>impl<'a, L> Future for ListenerAcceptFut<'a, L> where
L: Listener, type Output = Result<(L::Io, L::Addr)>;
where
Self: Sized,
{ ... }
}
Available on crate features
net
and codec
only.Expand description
A trait for a listener: TcpListener
and UnixListener
.
Required Associated Types
type Io: AsyncRead + AsyncWrite
type Io: AsyncRead + AsyncWrite
The stream’s type of this listener.
Required Methods
Polls to accept a new incoming connection to this listener.
fn local_addr(&self) -> Result<Self::Addr>
fn local_addr(&self) -> Result<Self::Addr>
Returns the local address that this listener is bound to.
Provided Methods
fn accept(&mut self) -> ListenerAcceptFut<'_, Self>ⓘNotable traits for ListenerAcceptFut<'a, L>impl<'a, L> Future for ListenerAcceptFut<'a, L> where
L: Listener, type Output = Result<(L::Io, L::Addr)>;
where
Self: Sized,
fn accept(&mut self) -> ListenerAcceptFut<'_, Self>ⓘNotable traits for ListenerAcceptFut<'a, L>impl<'a, L> Future for ListenerAcceptFut<'a, L> where
L: Listener, type Output = Result<(L::Io, L::Addr)>;
where
Self: Sized,
L: Listener, type Output = Result<(L::Io, L::Addr)>;
Accepts a new incoming connection from this listener.