pub struct SendStream { /* private fields */ }Expand description
A stream that can be used to send bytes. See quinn::SendStream.
This wrapper exists primarily to adapt error codes. WebTransport uses u32 error codes that map into the reserved HTTP/3 error space.
Implementations§
Source§impl SendStream
impl SendStream
Sourcepub fn reset(&mut self, code: u32) -> Result<(), ClosedStream>
pub fn reset(&mut self, code: u32) -> Result<(), ClosedStream>
Abruptly reset the stream with the provided error code. See quinn::SendStream::reset.
WebTransport uses a u32 because it shares the error space with HTTP/3.
Sourcepub async fn stopped(&self) -> Result<Option<u32>, SessionError>
pub async fn stopped(&self) -> Result<Option<u32>, SessionError>
Wait until the stream has been stopped and return the error code. See quinn::SendStream::stopped.
Unlike Quinn, this returns None when the code is not a valid WebTransport error code.
It also returns SessionError (not StoppedError) because 0-RTT is not supported.
Sourcepub async fn write(&mut self, buf: &[u8]) -> Result<usize, WriteError>
pub async fn write(&mut self, buf: &[u8]) -> Result<usize, WriteError>
Write some data to the stream, returning the size written. See quinn::SendStream::write.
Sourcepub async fn write_all(&mut self, buf: &[u8]) -> Result<(), WriteError>
pub async fn write_all(&mut self, buf: &[u8]) -> Result<(), WriteError>
Write all of the data to the stream. See quinn::SendStream::write_all.
Sourcepub async fn write_chunks(
&mut self,
bufs: &mut [Bytes],
) -> Result<Written, WriteError>
pub async fn write_chunks( &mut self, bufs: &mut [Bytes], ) -> Result<Written, WriteError>
Write chunks of data to the stream. See quinn::SendStream::write_chunks.
Sourcepub async fn write_chunk(&mut self, buf: Bytes) -> Result<(), WriteError>
pub async fn write_chunk(&mut self, buf: Bytes) -> Result<(), WriteError>
Write a chunk of data to the stream. See quinn::SendStream::write_chunk.
Sourcepub async fn write_all_chunks(
&mut self,
bufs: &mut [Bytes],
) -> Result<(), WriteError>
pub async fn write_all_chunks( &mut self, bufs: &mut [Bytes], ) -> Result<(), WriteError>
Write all of the chunks of data to the stream. See quinn::SendStream::write_all_chunks.
Sourcepub fn finish(&mut self) -> Result<(), ClosedStream>
pub fn finish(&mut self) -> Result<(), ClosedStream>
Mark the stream as finished so no more data can be written. See quinn::SendStream::finish.
WARNING: Quinn implicitly calls this on drop. Dropping futures can lead to incomplete writes, so prefer explicit shutdown when possible.
Sourcepub fn set_priority(&self, order: i32) -> Result<(), ClosedStream>
pub fn set_priority(&self, order: i32) -> Result<(), ClosedStream>
Set stream scheduling priority.
Lower values are generally scheduled earlier by QUIC.
Sourcepub fn priority(&self) -> Result<i32, ClosedStream>
pub fn priority(&self) -> Result<i32, ClosedStream>
Get the current stream scheduling priority.
Sourcepub fn quic_id(&self) -> StreamId
pub fn quic_id(&self) -> StreamId
Return the underlying QUIC stream ID.
Warning
WebTransport sessions share the QUIC connection with HTTP/3 and other sessions. The quinn::StreamId::index may not increment by 1 as it does in a standalone quinn connection. The JavaScript WebTransport API therefore does not expose stream IDs.
Trait Implementations§
Source§impl AsyncWrite for SendStream
impl AsyncWrite for SendStream
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read more