Trait quicr::Read[][src]

pub trait Read {
    fn poll_read_unordered(&mut self) -> Poll<(Bytes, u64), ReadError>;
fn poll_read(&mut self, buf: &mut [u8]) -> Poll<usize, ReadError>;
fn stop(&mut self, error_code: u16); }

Trait of readable streams

Required Methods

Read a segment of data from any offset in the stream.

Returns a segment of data and their offset in the stream. Segments may be received in any order and may overlap.

Using this function reduces latency improves throughput by avoiding head-of-line blocking within the stream, and reduces computational overhead by allowing data to be passed on without any intermediate buffering. Prefer it whenever possible.

Read data contiguously from the stream.

Incurs latency, throughput, and computational overhead and is not necessary for most applications. Prefer poll_read_unordered whenever possible.

Panics

  • If called after poll_read_unordered was called on the same stream. This is forbidden because an unordered read could consume a segment of data from a location other than the start of the receive buffer, making it impossible for future ordered reads to proceed.

Abandon receiving data on this stream.

The peer is notified and will reset this stream in response.

Implementors