[][src]Trait hydrogen::Stream

pub trait Stream: AsRawFd + Send + Sync {
    fn recv(&mut self) -> Result<Vec<Vec<u8>>, Error>;
fn send(&mut self, buf: &[u8]) -> Result<(), Error>;
fn shutdown(&mut self) -> Result<(), Error>; }

Trait object responsible for handling reported I/O events.

Required methods

fn recv(&mut self) -> Result<Vec<Vec<u8>>, Error>

Called when epoll reports data is available for read.

This method should read until ErrorKind::WouldBlock is received. At that time, all complete messages should be returned, otherwise return the std::io::Error.

fn send(&mut self, buf: &[u8]) -> Result<(), Error>

Called as the internal writer for the HydrogenSocket wrapper.

This method should write until all bytes have been written or any std::io::Error is returned.

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

This method is called when any error, other than ErrorKind::WouldBlock, is returned from a recv or send call.

Loading content...

Implementors

Loading content...