pub struct RecvStream { /* private fields */ }
Expand description
An incoming stream of bytes from the peer.
All bytes are flushed in order and the stream is flow controlled. The stream will be closed with STOP_SENDING code=0 when dropped.
Implementations§
Source§impl RecvStream
impl RecvStream
Sourcepub async fn read(&mut self, max: usize) -> Result<Option<Bytes>, Error>
pub async fn read(&mut self, max: usize) -> Result<Option<Bytes>, Error>
Read the next chunk of data with the provided maximum size.
This returns a chunk of data instead of copying, which may be more efficient.
Sourcepub async fn read_buf<B: BufMut>(
&mut self,
buf: &mut B,
) -> Result<Option<usize>, Error>
pub async fn read_buf<B: BufMut>( &mut self, buf: &mut B, ) -> Result<Option<usize>, Error>
Read some data into the provided buffer.
The number of bytes read is returned, or None if the stream is closed. The buffer will be advanced by the number of bytes read.
Sourcepub async fn closed(&mut self) -> Result<Option<u8>, Error>
pub async fn closed(&mut self) -> Result<Option<u8>, Error>
Block until the stream has been closed and return the error code, if any.
This returns a (potentially truncated) u8 because that’s what the WASM implementation returns. web-transport-quinn returns a u32 because that’s what the specification says.
Auto Trait Implementations§
impl Freeze for RecvStream
impl RefUnwindSafe for RecvStream
impl Send for RecvStream
impl Sync for RecvStream
impl Unpin for RecvStream
impl UnwindSafe for RecvStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more