# Struct h2::RecvStream [−] [src]

    #[must_use = "streams do nothing unless polled"]pub struct RecvStream { /* fields omitted */ }

Receives the body stream and trailers from the remote peer.

A `RecvStream` is provided by `client::ResponseFuture` and `server::Connection` with the received HTTP/2.0 message head (the response and request head respectively).

A `RecvStream` instance is used to receive the streaming message body and any trailers from the remote peer. It is also used to manage inbound flow control.

See method level documentation for more details on receiving data. See `FlowControl` for more details on inbound flow control.

Note that this type implements `Stream`, yielding the received data frames. When this implementation is used, the capacity is immediately released when the data is yielded. It is recommended to only use this API when the data will not be retained in memory for extended periods of time.

## Implementations

### `impl RecvStream` [src]

#### `pub async fn data(&mut self) -> Option<Result<Bytes, Error>>` [src]

Get the next data frame.

#### `pub async fn trailers(&mut self) -> Result<Option<HeaderMap>, Error>` [src]

Get optional trailers for this stream.

#### `pub fn is_end_stream(&self) -> bool` [src]

Returns true if the receive half has reached the end of stream.

A return value of `true` means that calls to `poll` and `poll_trailers` will both return `None`.

#### `pub fn flow_control(&mut self) -> &mut FlowControl` [src]

Get a mutable reference to this stream’s `FlowControl`.

It can be used immediately, or cloned to be used later.

#### `pub fn stream_id(&self) -> StreamId` [src]

Returns the stream ID of this stream.

# Panics

If the lock on the stream store has been poisoned.

## Trait Implementations

### `impl Debug for RecvStream` [src]

#### `fn fmt(&self, fmt: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl Drop for RecvStream` [src]

#### `fn drop(&mut self)` [src]

Executes the destructor for this type. Read more

## Auto Trait Implementations

### `impl RefUnwindSafe for RecvStream`

### `impl Send for RecvStream`

### `impl Sync for RecvStream`

### `impl Unpin for RecvStream`

### `impl UnwindSafe for RecvStream`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T> Instrument for T` [src]

#### `pub fn instrument(self, span: Span) -> Instrumented<Self>` [src]

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

#### `pub fn in_current_span(self) -> Instrumented<Self>` [src]

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

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

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

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.