Skip to main content

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl NetStreamListener for TcpListener

Source§

impl NetStreamListener for TcpListener

Source§

impl NetStreamListener<SocketAddr> for UnixListener

Source§

impl NetStreamListener<SocketAddr> for UnixListener

Implementors§