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§

source§

impl SendStream

source

pub async fn write(&mut self, buf: &[u8]) -> 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.

source

pub async fn write_all(&mut self, buf: &[u8]) -> Result<(), WriteError>

Convenience method to write an entire buffer to the stream

source

pub async fn write_chunks( &mut self, bufs: &mut [Bytes] ) -> 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

source

pub async fn write_chunk(&mut self, buf: Bytes) -> Result<(), WriteError>

Convenience method to write a single chunk in its entirety to the stream

source

pub async fn write_all_chunks( &mut self, bufs: &mut [Bytes] ) -> Result<(), WriteError>

Convenience method to write an entire list of chunks to the stream

source

pub async fn finish(&mut self) -> Result<(), WriteError>

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.

source

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.

source

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.

source

pub fn priority(&self) -> Result<i32, UnknownStream>

Get the priority of the send stream

source

pub async fn stopped(&mut self) -> Result<VarInt, StoppedError>

Completes if/when the peer stops the stream, yielding the error code

source

pub fn id(&self) -> StreamId

Get the identity of this stream

Trait Implementations§

source§

impl AsyncWrite for SendStream

source§

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
source§

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
source§

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
source§

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
source§

fn is_write_vectored(&self) -> bool

Determines if this writer has an efficient poll_write_vectored implementation. Read more
source§

impl AsyncWrite for SendStream

source§

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
source§

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
source§

fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

Attempt to close the object. Read more
source§

fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>] ) -> Poll<Result<usize, Error>>

Attempt to write bytes from bufs into the object using vectored IO operations. Read more
source§

impl Debug for SendStream

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for SendStream

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<W> AsyncWriteExt for Wwhere W: AsyncWrite + ?Sized,

§

fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where Self: Unpin,

Writes some bytes into the byte stream. Read more
§

fn write_vectored<'a>( &'a mut self, bufs: &'a [IoSlice<'a>] ) -> WriteVectoredFuture<'a, Self>where Self: Unpin,

Like [write()][AsyncWriteExt::write()], except that it writes a slice of buffers. Read more
§

fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where Self: Unpin,

Writes an entire buffer into the byte stream. Read more
§

fn flush(&mut self) -> FlushFuture<'_, Self>where Self: Unpin,

Flushes the stream to ensure that all buffered contents reach their destination. Read more
§

fn close(&mut self) -> CloseFuture<'_, Self>where Self: Unpin,

Closes the writer. Read more
§

fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + Send + 'a, Global>>where Self: Sized + Send + 'a,

Boxes the writer and changes its type to dyn AsyncWrite + Send + 'a. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WriteExt for Twhere T: AsyncWrite + ?Sized,

source§

fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where Self: Unpin,

Writes some bytes into the byte stream. Read more
source§

fn flush(&mut self) -> FlushFuture<'_, Self>where Self: Unpin,

Flushes the stream to ensure that all buffered contents reach their destination. Read more
source§

fn write_vectored<'a>( &'a mut self, bufs: &'a [IoSlice<'a>] ) -> WriteVectoredFuture<'a, Self>where Self: Unpin,

Like write, except that it writes from a slice of buffers. Read more
source§

fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where Self: Unpin,

Writes an entire buffer into the byte stream. Read more
source§

fn write_fmt<'a>(&'a mut self, fmt: Arguments<'_>) -> WriteFmtFuture<'a, Self>where Self: Unpin,

Writes a formatted string into this writer, returning any error encountered. Read more