# Struct h2::server::SendPushedResponse [−] [src]

    pub struct SendPushedResponse<B: Buf> { /* fields omitted */ }

Send a response to a promised request

A `SendPushedResponse` instance is provided when promising a request and is used to send the associated response to the client. It is also used to explicitly reset the stream with a custom reason.

It can not be used to initiate push promises.

If the `SendPushedResponse` instance is dropped without sending a response, then the HTTP/2.0 stream will be reset.

See module level docs for more details.

## Implementations

### `impl<B: Buf> SendPushedResponse<B>` [src]

#### `pub fn send_response(
&mut self,
response: Response<()>,
end_of_stream: bool
) -> Result<SendStream<B>, Error>` [src]

Send a response to a promised request.

On success, a `SendStream` instance is returned. This instance can be used to stream the response body and send trailers.

If a body or trailers will be sent on the returned `SendStream` instance, then `end_of_stream` must be set to `false` when calling this function.

The `SendPushedResponse` instance is associated with a promised request. This function may only be called once per instance and only if `send_reset` has not been previously called.

#### `pub fn send_reset(&mut self, reason: Reason)` [src]

Send a stream reset to the peer.

This essentially cancels the stream, including any inbound or outbound data streams.

If this function is called before `send_response`, a call to `send_response` will result in an error.

If this function is called while a `SendStream` instance is active, any further use of the instance will result in an error.

This function should only be called once.

#### `pub fn poll_reset(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<Reason, Error>>` [src]

Polls to be notified when the client resets this stream.

If stream is still open, this returns `Poll::Pending`, and registers the task to be notified if a `RST_STREAM` is received.

If a `RST_STREAM` frame is received for this stream, calling this method will yield the `Reason` for the reset.

# Error

Calling this method after having called `send_response` will return a user error.

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

Returns the stream ID of the response stream.

# Panics

If the lock on the stream store has been poisoned.

## Trait Implementations

### `impl<B: Buf + Debug> Debug for SendPushedResponse<B>` [src]

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

Formats the value using the given formatter. Read more

## Auto Trait Implementations

### `impl<B> RefUnwindSafe for SendPushedResponse<B>`

### `impl<B> Send for SendPushedResponse<B> where
B: Send,`

### `impl<B> Sync for SendPushedResponse<B> where
B: Send,`

### `impl<B> Unpin for SendPushedResponse<B>`

### `impl<B> UnwindSafe for SendPushedResponse<B>`

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