pub trait NetStreamListener<ADDR = SocketAddr> {
type Stream: AsyncRead + AsyncWrite + StreamOps + Send + Sync + Unpin + 'static;
type Incoming: Stream<Item = IoResult<(Self::Stream, ADDR)>> + Send + Sync + Unpin + 'static;
// Required methods
fn incoming(self) -> Self::Incoming;
fn local_addr(&self) -> IoResult<ADDR>;
}
Expand description
Trait for a local socket that accepts incoming streams.
These objects are returned by instances of NetStreamProvider
. To use
one,
use incoming
to convert this object into a stream::Stream
.
Required Associated Types§
Sourcetype Stream: AsyncRead + AsyncWrite + StreamOps + Send + Sync + Unpin + 'static
type Stream: AsyncRead + AsyncWrite + StreamOps + Send + Sync + Unpin + 'static
The type of connections returned by Self::incoming()
.
Sourcetype Incoming: Stream<Item = IoResult<(Self::Stream, ADDR)>> + Send + Sync + Unpin + 'static
type Incoming: Stream<Item = IoResult<(Self::Stream, ADDR)>> + Send + Sync + Unpin + 'static
The type of stream::Stream
returned by Self::incoming()
.
Required Methods§
Sourcefn incoming(self) -> Self::Incoming
fn incoming(self) -> Self::Incoming
Wrap this listener into a new stream::Stream
that yields
streams and addresses.
Sourcefn local_addr(&self) -> IoResult<ADDR>
fn local_addr(&self) -> IoResult<ADDR>
Return the local address that this listener is bound to.