Trait hyper::net::NetworkStream [−][src]
pub trait NetworkStream: Read + Write + Any + Send + Typeable {
fn peer_addr(&mut self) -> Result<SocketAddr>;
fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>;
fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>;
fn close(&mut self, _how: Shutdown) -> Result<()> { ... }
}
Expand description
An abstraction over streams that a Server
can utilize.
Required methods
fn peer_addr(&mut self) -> Result<SocketAddr>
fn peer_addr(&mut self) -> Result<SocketAddr>
Get the remote address of the underlying connection.
Set the maximum time to wait for a read to complete.
Provided methods
Implementations
If the underlying type is T
, get a reference to the contained data.
If the underlying type is T
, get a mutable reference to the contained
data.
pub fn downcast<T: Any>(
self: Box<dyn NetworkStream>
) -> Result<Box<T>, Box<dyn NetworkStream>>
pub fn downcast<T: Any>(
self: Box<dyn NetworkStream>
) -> Result<Box<T>, Box<dyn NetworkStream>>
If the underlying type is T
, extract it.
If the underlying type is T
, get a reference to the contained data.
If the underlying type is T
, get a mutable reference to the contained
data.