pub struct SendStream { /* private fields */ }
Expand description
A stream that can be used to send bytes. See quinn::SendStream
.
This wrapper is mainly needed for error codes, which is unfortunate. WebTransport uses u32 error codes and they’re mapped in a 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
.
This is a u32 with WebTransport because we share the error space with HTTP/3.
Sourcepub async fn stopped(&mut self) -> Result<Option<u32>, StoppedError>
pub async fn stopped(&mut self) -> Result<Option<u32>, StoppedError>
Wait until the stream has been stopped and return the error code. See quinn::SendStream::stopped
.
Unlike Quinn, this returns None if the code is not a valid WebTransport error code.
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>
Wait until all of the data has been written to the stream. See quinn::SendStream::finish
.
pub fn set_priority(&self, order: i32) -> Result<(), ClosedStream>
pub fn priority(&self) -> Result<i32, ClosedStream>
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