pub struct Stream(_);
Expand description

A readable and writeable QUIC stream

Implementations

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.

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.

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.

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.

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.

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.

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.

Initiates a RESET on the stream.

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

Receives a chunk of data from the stream.

The method will return:

  • Poll::Ready(Ok(Some(chunk))) if the stream is open and data was available
  • Poll::Ready(Ok(None)) if the stream was finished and all of the data was consumed
  • Poll::Ready(Err(stream_error)) if the stream could not be read, because the stream had previously entered an error state.
  • Poll::Pending if the stream is waiting to receive data from the peer. In this case, the caller should retry sending after the Waker on the provided Context is notified.

Receives a slice of chunks of data from the stream.

The method will return:

  • Poll::Ready(Ok((len, is_open))) if the stream received data into the slice, where len was the number of chunks received, and is_open indicating if the stream is still open. If is_open == false, future calls to poll_receive_vectored will always return Poll::Ready(Ok((0, false))).
  • Poll::Ready(Err(stream_error)) if the stream could not be read, because the stream had previously entered an error state.
  • Poll::Pending if the stream is waiting to receive data from the peer. In this case, the caller should retry sending after the Waker on the provided Context is notified.

Sends a STOP_SENDING message to the peer. This requests the peer to finish the Stream as soon as possible by issuing a RESET with the provided error_code.

Since this is merely a request to the peer to RESET the Stream, the Stream will not immediately be in a RESET state after issuing this API call.

If the Stream had been previously reset by the peer or if all data had already been received the API call will not trigger any action.

Splits a bidirectional QUIC Stream in two halves.

One half can be used to read data from the Stream. The other half can be used to send data.

Trait Implementations

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.