Skip to main content

Chunks

Trait Chunks 

Source
pub trait Chunks: 'static {
    type Error: Error;

    // Required methods
    fn poll_read_chunk(
        &mut self,
        waiter: &Waiter,
        max: usize,
    ) -> Poll<Result<Option<Bytes>, Self::Error>>;
    fn stop(&mut self, code: u32);

    // Provided method
    fn poll_reset(&mut self, waiter: &Waiter) -> Poll<Self::Error> { ... }
}
Expand description

A receive stream read as plain chunks, whose flow-control credit returns as it reads.

Buffered turns one into a RecvStream.

Required Associated Types§

Source

type Error: Error

The error type for every operation on this stream.

Required Methods§

Source

fn poll_read_chunk( &mut self, waiter: &Waiter, max: usize, ) -> Poll<Result<Option<Bytes>, Self::Error>>

Poll for the next chunk, up to max bytes, or None once the peer finished the stream.

Source

fn stop(&mut self, code: u32)

Send a STOP_SENDING code. See RecvStream::stop.

An implementation MUST also do this on Drop: Buffered forwards an explicit stop but leaves the drop to the wrapped stream.

Provided Methods§

Source

fn poll_reset(&mut self, waiter: &Waiter) -> Poll<Self::Error>

Poll until the stream fails without reading it. See RecvStream::poll_reset.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§