pub struct WebTransportRecvStream { /* private fields */ }Available on (crate features
http1 or http2 or http3) and crate feature http3 and crate feature webtransport only.Expand description
A receive-only WebTransport stream.
Implementations§
Source§impl WebTransportRecvStream
impl WebTransportRecvStream
Sourcepub fn into_inner(self) -> WtRecvStream<RecvStream, Bytes>
pub fn into_inner(self) -> WtRecvStream<RecvStream, Bytes>
Get the inner h3_webtransport::stream::RecvStream.
Can be used to access lower-level functionality.
Sourcepub async fn read_to_end(&mut self, max_size: usize) -> Result<Bytes, Error>
pub async fn read_to_end(&mut self, max_size: usize) -> Result<Bytes, Error>
Read all remaining data from the stream until it’s finished.
This collects all chunks into a single Bytes object.
Returns an io::Error if the total size exceeds max_size or any read
call errors.
§Example
ⓘ
let data = recv_stream.read_to_end(1024 * 1024).await?; // max 1MB
println!("Received complete message: {} bytes", data.len());Sourcepub fn stop_sending(&mut self, error_code: u64)
pub fn stop_sending(&mut self, error_code: u64)
Stop receiving data on this stream with an error code.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebTransportRecvStream
impl !RefUnwindSafe for WebTransportRecvStream
impl Send for WebTransportRecvStream
impl Sync for WebTransportRecvStream
impl Unpin for WebTransportRecvStream
impl !UnwindSafe for WebTransportRecvStream
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