Trait hyper::net::NetworkStream
source · 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§
sourcefn peer_addr(&mut self) -> Result<SocketAddr>
fn peer_addr(&mut self) -> Result<SocketAddr>
Get the remote address of the underlying connection.
Provided Methods§
Implementations§
source§impl dyn NetworkStream
impl dyn NetworkStream
sourcepub fn downcast_ref<T: Any>(&self) -> Option<&T>
pub fn downcast_ref<T: Any>(&self) -> Option<&T>
If the underlying type is T
, get a reference to the contained data.
sourcepub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>
pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>
If the underlying type is T
, get a mutable reference to the contained
data.
sourcepub 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.
source§impl dyn NetworkStream + Send
impl dyn NetworkStream + Send
sourcepub fn downcast_ref<T: Any>(&self) -> Option<&T>
pub fn downcast_ref<T: Any>(&self) -> Option<&T>
If the underlying type is T
, get a reference to the contained data.
sourcepub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>
pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>
If the underlying type is T
, get a mutable reference to the contained
data.