Struct quinn::SendStream
source · [−]pub struct SendStream { /* private fields */ }
Expand description
A stream that can only be used to send data
If dropped, streams that haven’t been explicitly reset()
will continue to (re)transmit
previously written data until it has been fully acknowledged or the connection is closed.
Implementations
sourceimpl SendStream
impl SendStream
sourcepub fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a>ⓘNotable traits for Write<'a>impl<'a> Future for Write<'a> type Output = Result<usize, WriteError>;
pub fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a>ⓘNotable traits for Write<'a>impl<'a> Future for Write<'a> type Output = Result<usize, WriteError>;
Write bytes to the stream
Yields the number of bytes written on success. Congestion and flow control may cause this to
be shorter than buf.len()
, indicating that only a prefix of buf
was written.
sourcepub fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAll<'a>ⓘNotable traits for WriteAll<'a>impl<'a> Future for WriteAll<'a> type Output = Result<(), WriteError>;
pub fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAll<'a>ⓘNotable traits for WriteAll<'a>impl<'a> Future for WriteAll<'a> type Output = Result<(), WriteError>;
Convenience method to write an entire buffer to the stream
sourcepub fn write_chunks<'a>(&'a mut self, bufs: &'a mut [Bytes]) -> WriteChunks<'a>ⓘNotable traits for WriteChunks<'a>impl<'a> Future for WriteChunks<'a> type Output = Result<Written, WriteError>;
pub fn write_chunks<'a>(&'a mut self, bufs: &'a mut [Bytes]) -> WriteChunks<'a>ⓘNotable traits for WriteChunks<'a>impl<'a> Future for WriteChunks<'a> type Output = Result<Written, WriteError>;
Write chunks to the stream
Yields the number of bytes and chunks written on success.
Congestion and flow control may cause this to be shorter than buf.len()
,
indicating that only a prefix of bufs
was written
sourcepub fn write_chunk(&mut self, buf: Bytes) -> WriteChunk<'_>ⓘNotable traits for WriteChunk<'a>impl<'a> Future for WriteChunk<'a> type Output = Result<(), WriteError>;
pub fn write_chunk(&mut self, buf: Bytes) -> WriteChunk<'_>ⓘNotable traits for WriteChunk<'a>impl<'a> Future for WriteChunk<'a> type Output = Result<(), WriteError>;
Convenience method to write a single chunk in its entirety to the stream
sourcepub fn write_all_chunks<'a>(
&'a mut self,
bufs: &'a mut [Bytes]
) -> WriteAllChunks<'a>ⓘNotable traits for WriteAllChunks<'a>impl<'a> Future for WriteAllChunks<'a> type Output = Result<(), WriteError>;
pub fn write_all_chunks<'a>(
&'a mut self,
bufs: &'a mut [Bytes]
) -> WriteAllChunks<'a>ⓘNotable traits for WriteAllChunks<'a>impl<'a> Future for WriteAllChunks<'a> type Output = Result<(), WriteError>;
Convenience method to write an entire list of chunks to the stream
sourcepub fn finish(&mut self) -> Finish<'_>
pub fn finish(&mut self) -> Finish<'_>
Shut down the send stream gracefully.
No new data may be written after calling this method. Completes when the peer has acknowledged all sent data, retransmitting data as needed.
sourcepub fn reset(&mut self, error_code: VarInt) -> Result<(), UnknownStream>
pub fn reset(&mut self, error_code: VarInt) -> Result<(), UnknownStream>
Close the send stream immediately.
No new data can be written after calling this method. Locally buffered data is dropped, and previously transmitted data will no longer be retransmitted if lost. If an attempt has already been made to finish the stream, the peer may still receive all written data.
sourcepub fn set_priority(&self, priority: i32) -> Result<(), UnknownStream>
pub fn set_priority(&self, priority: i32) -> Result<(), UnknownStream>
Set the priority of the send stream
Every send stream has an initial priority of 0. Locally buffered data from streams with higher priority will be transmitted before data from streams with lower priority. Changing the priority of a stream with pending data may only take effect after that data has been transmitted. Using many different priority levels per connection may have a negative impact on performance.
Trait Implementations
sourceimpl AsyncWrite for SendStream
impl AsyncWrite for SendStream
sourcefn 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>>
Attempt to write bytes from buf
into the object. Read more
sourcefn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
sourceimpl AsyncWrite for SendStream
impl AsyncWrite for SendStream
sourcefn 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>>
Attempt to write bytes from buf
into the object. Read more
sourcefn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
Attempts to flush the object, ensuring that any buffered data reach their destination. Read more
sourcefn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more
sourcefn 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>>
Like poll_write
, except that it writes from a slice of buffers. Read more
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
Determines if this writer has an efficient poll_write_vectored
implementation. Read more
sourceimpl Debug for SendStream
impl Debug for SendStream
Auto Trait Implementations
impl !RefUnwindSafe for SendStream
impl Send for SendStream
impl Sync for SendStream
impl Unpin for SendStream
impl !UnwindSafe for SendStream
Blanket Implementations
sourceimpl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
sourcefn flush(&mut self) -> Flush<'_, Self> where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self> where
Self: Unpin,
Creates a future which will entirely flush this AsyncWrite
. Read more
sourcefn close(&mut self) -> Close<'_, Self> where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self> where
Self: Unpin,
Creates a future which will entirely close this AsyncWrite
.
sourcefn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self> where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self> where
Self: Unpin,
Creates a future which will write bytes from buf
into the object. Read more
sourcefn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
Creates a future which will write bytes from bufs
into the object using vectored
IO operations. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more