Trait time::server::ServerStream

source ·
pub trait ServerStream<T> {
    // Required methods
    fn read(&self, stream: &T) -> Result<Request>;
    fn write(&self, stream: &mut T, res: Response) -> Result<()>;

    // Provided method
    fn handle(&self, timer: ThreadSafeTimer, stream: &mut T) -> Result<()> { ... }
}
Available on crate feature server only.
Expand description

The server stream trait.

ServerBinders may implement this trait, but it is not mandatory. It can be seen as a helper: by implementing the ServerStream::read and the ServerStream::write functions, the trait can deduce how to handle a request.

Required Methods§

source

fn read(&self, stream: &T) -> Result<Request>

source

fn write(&self, stream: &mut T, res: Response) -> Result<()>

Provided Methods§

source

fn handle(&self, timer: ThreadSafeTimer, stream: &mut T) -> Result<()>

Implementors§

source§

impl ServerStream<TcpStream> for TcpBind

Available on crate feature tcp-binder only.