pub struct RecvStream { /* private fields */ }
Expand description

A stream that can only be used to receive data

stop(0) is implicitly called on drop unless:

  • A variant of ReadError has been yielded by a read call
  • stop() was called explicitly

Implementations

Read data contiguously from the stream.

Yields the number of bytes read into buf on success, or None if the stream was finished.

Read an exact number of bytes contiguously from the stream.

See read() for details.

Read the next segment of data

Yields None if the stream was finished. Otherwise, yields a segment of data and its offset in the stream. If ordered is true, the chunk’s offset will be immediately after the last data yielded by read() or read_chunk(). If ordered is false, segments may be received in any order, and the Chunk’s offset field can be used to determine ordering in the caller. Unordered reads are less prone to head-of-line blocking within a stream, but require the application to manage reassembling the original data.

Slightly more efficient than read due to not copying. Chunk boundaries do not correspond to peer writes, and hence cannot be used as framing.

Read the next segments of data

Fills bufs with the segments of data beginning immediately after the last data yielded by read or read_chunk, or None if the stream was finished.

Slightly more efficient than read due to not copying. Chunk boundaries do not correspond to peer writes, and hence cannot be used as framing.

Convenience method to read all remaining data into a buffer

The returned future fails with ReadToEndError::TooLong if it’s longer than size_limit bytes. Uses unordered reads to be more efficient than using AsyncRead would allow. size_limit should be set to limit worst-case memory use.

If unordered reads have already been made, the resulting buffer may have gaps containing arbitrary data.

Stop accepting data

Discards unread data and notifies the peer to stop transmitting. Once stopped, further attempts to operate on a stream will yield UnknownStream errors.

Check if this stream has been opened during 0-RTT.

In which case any non-idempotent request should be considered dangerous at the application level. Because read data is subject to replay attacks.

Get the identity of this stream

Trait Implementations

Attempt to read from the AsyncRead into buf. Read more

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more

Attempts to read from the AsyncRead into buf. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Creates an adaptor which will chain this stream with another. Read more

Tries to read some bytes directly into the given buf in asynchronous manner, returning a future type. Read more

Creates a future which will read from the AsyncRead into bufs using vectored IO operations. Read more

Creates a future which will read exactly enough bytes to fill buf, returning an error if end of file (EOF) is hit sooner. Read more

Creates a future which will read all the bytes from this AsyncRead. Read more

Creates a future which will read all the bytes from this AsyncRead. Read more

Helper method for splitting this read/write object into two halves. Read more

Creates an AsyncRead adapter which will read at most limit bytes from the underlying reader. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

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