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§
Required Methods§
Sourcefn poll_read_chunk(
&mut self,
waiter: &Waiter,
max: usize,
) -> Poll<Result<Option<Bytes>, Self::Error>>
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.
Sourcefn stop(&mut self, code: u32)
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§
Sourcefn poll_reset(&mut self, waiter: &Waiter) -> Poll<Self::Error>
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".