Trait rocket::http::hyper::net::NetworkStream

source ·
pub trait NetworkStream: Read + Write + Any + Send + Typeable {
    // Required methods
    fn peer_addr(&mut self) -> Result<SocketAddr, Error>;
    fn set_read_timeout(&self, dur: Option<Duration>) -> Result<(), Error>;
    fn set_write_timeout(&self, dur: Option<Duration>) -> Result<(), Error>;

    // Provided method
    fn close(&mut self, _how: Shutdown) -> Result<(), Error> { ... }
}
Expand description

An abstraction over streams that a Server can utilize.

Required Methods§

source

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

Get the remote address of the underlying connection.

source

fn set_read_timeout(&self, dur: Option<Duration>) -> Result<(), Error>

Set the maximum time to wait for a read to complete.

source

fn set_write_timeout(&self, dur: Option<Duration>) -> Result<(), Error>

Set the maximum time to wait for a write to complete.

Provided Methods§

source

fn close(&mut self, _how: Shutdown) -> Result<(), Error>

This will be called when Stream should no longer be kept alive.

Implementations§

source§

impl dyn NetworkStream

source

pub fn is<T>(&self) -> bool
where T: Any,

Is the underlying type in this trait object a T?

source

pub fn downcast_ref<T>(&self) -> Option<&T>
where T: Any,

If the underlying type is T, get a reference to the contained data.

source

pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: Any,

If the underlying type is T, get a mutable reference to the contained data.

source

pub fn downcast<T>( self: Box<dyn NetworkStream> ) -> Result<Box<T>, Box<dyn NetworkStream>>
where T: Any,

If the underlying type is T, extract it.

source§

impl dyn NetworkStream + Send

source

pub fn is<T>(&self) -> bool
where T: Any,

Is the underlying type in this trait object a T?

source

pub fn downcast_ref<T>(&self) -> Option<&T>
where T: Any,

If the underlying type is T, get a reference to the contained data.

source

pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: Any,

If the underlying type is T, get a mutable reference to the contained data.

source

pub fn downcast<T>( self: Box<dyn NetworkStream + Send> ) -> Result<Box<T>, Box<dyn NetworkStream + Send>>
where T: Any,

If the underlying type is T, extract it.

Implementors§