pub trait NetworkListener: Clone {
type Stream: NetworkStream + Send + Clone;
// Required methods
fn accept(&mut self) -> Result<Self::Stream, Error>;
fn local_addr(&mut self) -> Result<SocketAddr, Error>;
// Provided methods
fn incoming(&mut self) -> NetworkConnections<'_, Self> ⓘ { ... }
fn set_read_timeout(&mut self, _: Option<Duration>) { ... }
fn set_write_timeout(&mut self, _: Option<Duration>) { ... }
}
Expand description
An abstraction to listen for connections on a certain port.
Required Associated Types§
sourcetype Stream: NetworkStream + Send + Clone
type Stream: NetworkStream + Send + Clone
The stream produced for each connection.
Required Methods§
sourcefn local_addr(&mut self) -> Result<SocketAddr, Error>
fn local_addr(&mut self) -> Result<SocketAddr, Error>
Get the address this Listener ended up listening on.
Provided Methods§
sourcefn incoming(&mut self) -> NetworkConnections<'_, Self> ⓘ
fn incoming(&mut self) -> NetworkConnections<'_, Self> ⓘ
Returns an iterator over incoming connections.
sourcefn set_read_timeout(&mut self, _: Option<Duration>)
fn set_read_timeout(&mut self, _: Option<Duration>)
Sets the read timeout for all streams that are accepted
sourcefn set_write_timeout(&mut self, _: Option<Duration>)
fn set_write_timeout(&mut self, _: Option<Duration>)
Sets the write timeout for all streams that are accepted
Object Safety§
This trait is not object safe.