Trait time::client::ClientStream

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

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

The client stream trait.

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

Required Methods§

source

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

source

fn write(&self, stream: &mut T, req: Request) -> Result<()>

Provided Methods§

source

fn handle(&self, stream: &mut T, req: Request) -> Result<Response>

Implementors§

source§

impl ClientStream<TcpStream> for TcpClient

Available on crate feature tcp-client only.