Trait simple_stream::SRecv [] [src]

pub trait SRecv {
    fn recv(&mut self) -> Result<()Error>;
    fn drain_rx_queue(&mut self) -> Vec<Vec<u8>>;
}

The SRecv trait allows for reading bytes from a source.

Each call to recv will attempt to pull bytes from the source and place into the reader's internal buffer. When an Ok(()) result has been received, a complete message is capable of being pulled out from the internal buffer with drain_rx_queue.

Required Methods

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

Read bytes from the source into this Receiver's internal buffer.

This call may be block or non-blocking depending on which stream implements this trait. When an Ok(()) result is returned, at least one complete message has been received and can be pulled out from the internal buffer.

Errors

This call will return an Error for any std::io::Error encountered during the read.

fn drain_rx_queue(&mut self) -> Vec<Vec<u8>>

Drain the internal queue of recv'd messages, leaving the internal buffer empty. The length of the returned queue should be expected to be 1 when used on a blocking stream, and >= 1 when used on a non-blocking stream.

Implementors