NetStreamListener

Trait NetStreamListener 

Source
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§

Source

type Stream: AsyncRead + AsyncWrite + StreamOps + Send + Sync + Unpin + 'static

The type of connections returned by Self::incoming().

Source

type Incoming: Stream<Item = IoResult<(Self::Stream, ADDR)>> + Send + Sync + Unpin + 'static

The type of stream::Stream returned by Self::incoming().

Required Methods§

Source

fn incoming(self) -> Self::Incoming

Wrap this listener into a new stream::Stream that yields streams and addresses.

Source

fn local_addr(&self) -> IoResult<ADDR>

Return the local address that this listener is bound to.

Implementors§