Struct s2n_quic_transport::stream::ReceiveStream

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

A readable QUIC stream

Implementations§

source§

impl ReceiveStream

source

pub fn id(&self) -> StreamId

source

pub fn connection(&self) -> &Connection

source

pub fn rx_request(&mut self) -> Result<RxRequest<'_, '_>, StreamError>

source

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

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

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

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

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

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.

Trait Implementations§

source§

impl Debug for ReceiveStream

source§

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

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

impl From<Stream> for ReceiveStream

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