Trait RecvStream
pub trait RecvStream:
Send
+ Sync
+ Unpin
+ 'static {
// Required methods
fn id(&self) -> StreamId;
fn poll_read_chunk(
&mut self,
cx: &mut Context<'_>,
max_length: usize,
) -> Poll<Result<Option<Bytes>, ReadError>>;
fn stop(&mut self, error_code: VarInt) -> Result<(), ClosedStream>;
fn is_0rtt(&self) -> bool;
// Provided method
fn boxed(self) -> Box<dyn RecvStream>
where Self: Sized { ... }
}Available on crate features
http-backend and http and std only.Required Methods§
fn id(&self) -> StreamId
fn poll_read_chunk(
&mut self,
cx: &mut Context<'_>,
max_length: usize,
) -> Poll<Result<Option<Bytes>, ReadError>>
fn poll_read_chunk( &mut self, cx: &mut Context<'_>, max_length: usize, ) -> Poll<Result<Option<Bytes>, ReadError>>
Read the next in-order chunk of at most max_length bytes; None at the end of the stream.
Deliver already received, contiguous bytes before reporting connection loss, including
after a clean connection close, so HTTP/3 can drain buffered control and QPACK data.
Returning Pending must not consume bytes and must arrange to wake cx when data or
a terminal result becomes available.
fn stop(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
fn stop(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
Stop this RecvStream with error_code
Provided Methods§
fn boxed(self) -> Box<dyn RecvStream>where
Self: Sized,
fn boxed(self) -> Box<dyn RecvStream>where
Self: Sized,
Erase the stream’s type, without boxing an already boxed stream.
Trait Implementations§
§impl RecvStream for Box<dyn RecvStream>
impl RecvStream for Box<dyn RecvStream>
fn id(&self) -> StreamId
§fn poll_read_chunk(
&mut self,
cx: &mut Context<'_>,
max_length: usize,
) -> Poll<Result<Option<Bytes>, ReadError>>
fn poll_read_chunk( &mut self, cx: &mut Context<'_>, max_length: usize, ) -> Poll<Result<Option<Bytes>, ReadError>>
Read the next in-order chunk of at most
max_length bytes; None at the end of the stream.
Deliver already received, contiguous bytes before reporting connection loss, including
after a clean connection close, so HTTP/3 can drain buffered control and QPACK data.
Returning Pending must not consume bytes and must arrange to wake cx when data or
a terminal result becomes available.§fn stop(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
fn stop(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
Stop this
RecvStream with error_code§fn boxed(self) -> Box<dyn RecvStream>
fn boxed(self) -> Box<dyn RecvStream>
Erase the stream’s type, without boxing an already boxed stream.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".