[][src]Trait quinn::Read

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

Trait of readable streams

Required methods

fn poll_read(&mut self, buf: &mut [u8]) -> Poll<usize, ReadError>

Read data contiguously from the stream.

Returns the number of bytes read into buf on success.

Applications involving bulk data transfer should consider using unordered reads for improved performance.

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.

fn poll_read_unordered(&mut self) -> Poll<(Bytes, u64), ReadError>

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.

Unordered reads have reduced overhead and higher throughput, and should therefore be preferred when applicable.

fn stop(&mut self, error_code: u16)

Close the receive stream immediately.

The peer is notified and will cease transmitting on this stream, as if it had reset the stream itself. Further data may still be received on this stream if it was already in flight. Once called, a ReadError::Reset should be expected soon, although a peer might manage to finish the stream before it receives the reset, and a misbehaving peer might ignore the request entirely and continue sending until halted by flow control.

Has no effect if the incoming stream already finished.

Loading content...

Implementors

impl Read for BiStream
[src]

impl Read for RecvStream
[src]

Loading content...