Struct h2::server::SendResponse
[−]
[src]
pub struct SendResponse<B: IntoBuf> { /* fields omitted */ }
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. This is not yet implemented.
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.
Methods
impl<B: IntoBuf> SendResponse<B>
[src]
pub fn send_response(
&mut self,
response: Response<()>,
end_of_stream: bool
) -> Result<SendStream<B>, Error>
[src]
&mut self,
response: Response<()>,
end_of_stream: bool
) -> Result<SendStream<B>, Error>
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 true
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.
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.
Trait Implementations
Auto Trait Implementations
impl<B> Send for SendResponse<B> where
<B as IntoBuf>::Buf: Send,
<B as IntoBuf>::Buf: Send,
impl<B> Sync for SendResponse<B> where
<B as IntoBuf>::Buf: Send,
<B as IntoBuf>::Buf: Send,