Struct s2n_quic_transport::stream::SendStream

source ·
pub struct SendStream(/* private fields */);
Expand description

A writeable QUIC stream

Implementations§

source§

impl SendStream

source

pub fn id(&self) -> StreamId

source

pub fn connection(&self) -> &Connection

source

pub fn tx_request(&mut self) -> Result<TxRequest<'_, '_>, StreamError>

source

pub fn poll_send( &mut self, chunk: &mut Bytes, cx: &mut Context<'_> ) -> Poll<Result<(), StreamError>>

Enqueues a chunk of data for sending it towards the peer.

The method will return:

  • Poll::Ready(Ok(())) if the data was enqueued for sending. The provided Bytes will be replaced with an empty Bytes, in order to reduce needless ref count increases.
  • Poll::Ready(Err(stream_error)) if the data could not be sent, because the stream had previously entered an error state.
  • Poll::Pending if the send buffer capacity is currently exhausted. In this case, the caller should retry sending after the Waker on the provided Context is notified.
source

pub fn poll_send_vectored( &mut self, chunks: &mut [Bytes], cx: &mut Context<'_> ) -> Poll<Result<usize, StreamError>>

Enqueues a slice of chunks of data for sending it towards the peer.

The method will return:

  • Poll::Ready(Ok(count)) if part of the slice was enqueued for sending. Any of the consumed Bytes will be replaced with an empty Bytes, in order to reduce needless ref count increases. If count does not equal the total number of chunks, the stream will store the waker and wake the task once more capacity is available.
  • Poll::Ready(Err(stream_error)) if the data could not be sent, because the stream had previously entered an error state.
  • Poll::Pending if the send buffer capacity is currently exhausted. In this case, the caller should retry sending after the Waker on the provided Context is notified.
source

pub fn poll_send_ready( &mut self, cx: &mut Context<'_> ) -> Poll<Result<usize, StreamError>>

Polls send readiness for the given stream.

The method will return:

  • Poll::Ready(Ok(available_bytes)) if the stream is ready to send data, where available_bytes is how many bytes the stream can currently accept.
  • Poll::Ready(Err(stream_error)) if the data could not be sent, because the stream had previously entered an error state.
  • Poll::Pending if the send buffer capacity is currently exhausted. In this case, the caller should retry sending after the Waker on the provided Context is notified.
source

pub fn send_data(&mut self, chunk: Bytes) -> Result<(), StreamError>

Enqueues a chunk of data for sending it towards the peer.

This method should only be called after calling poll_send_ready first, as the stream may not have available send buffer capacity.

The method will return:

  • Ok(()) if the data was enqueued for sending.
  • Err(stream_error) if the data could not be sent, because the stream had previously entered an error state, or the stream was not ready to send data.
source

pub fn poll_flush( &mut self, cx: &mut Context<'_> ) -> Poll<Result<(), StreamError>>

Flushes the send buffer and waits for acknowledgement from the peer.

The method will return:

  • Poll::Ready(Ok(())) if the send buffer was completely flushed and acknowledged.
  • Poll::Ready(Err(stream_error)) if the stream could not be flushed, because the stream had previously entered an error state.
  • Poll::Pending if the send buffer is still being flushed. In this case, the caller should retry sending after the Waker on the provided Context is notified.
source

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

Marks the stream as finished.

The method will return:

  • Ok(()) if the stream was finished successfully
  • Err(stream_error) if the stream could not be finished, because the stream had previously entered an error state.
source

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

Marks the stream as finished and waits for all outstanding data to be acknowledged

The method will return:

  • Poll::Ready(Ok(())) if the stream was completely flushed and acknowledged.
  • Poll::Ready(Err(stream_error)) if the stream could not be flushed, because the stream had previously entered an error state.
  • Poll::Pending if the stream is still being flushed. In this case, the caller should retry sending after the Waker on the provided Context is notified.
source

pub fn reset(&mut self, error_code: Error) -> Result<(), StreamError>

Initiates a RESET on the stream.

This will close the stream and notify the peer of the provided error_code.

Trait Implementations§

source§

impl Debug for SendStream

source§

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

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

impl From<Stream> for SendStream

source§

fn from(stream: Stream) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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 T
where 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 T
where 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.
source§

impl<T, U> Upcast<T> for U
where T: UpcastFrom<U>,

source§

fn upcast(self) -> T

source§

impl<T, B> UpcastFrom<Counter<T, B>> for T

source§

fn upcast_from(value: Counter<T, B>) -> T