Struct h2::server::SendResponse[][src]

pub struct SendResponse<B: Buf> { /* fields omitted */ }
Expand description

Send a response back to the client

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

It will also be used to initiate push promises linked with the associated stream.

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

See module level docs for more details.

Implementations

Send a response to a client 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 SendResponse instance is already associated with a received request. This function may only be called once per instance and only if send_reset has not been previously called.

Push a request and response to the client

On success, a SendResponse instance is returned.

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.

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.

Returns the stream ID of the response stream.

Panics

If the lock on the stream store has been poisoned.

Trait Implementations

Formats the value using the given formatter. Read more

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

Performs the conversion.

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

Performs the conversion.

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