Trait rocket::http::hyper::net::NetworkListener

source ·
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§

source

type Stream: NetworkStream + Send + Clone

The stream produced for each connection.

Required Methods§

source

fn accept(&mut self) -> Result<Self::Stream, Error>

Returns an iterator of streams.

source

fn local_addr(&mut self) -> Result<SocketAddr, Error>

Get the address this Listener ended up listening on.

Provided Methods§

source

fn incoming(&mut self) -> NetworkConnections<'_, Self>

Returns an iterator over incoming connections.

source

fn set_read_timeout(&mut self, _: Option<Duration>)

Sets the read timeout for all streams that are accepted

source

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.

Implementors§