Struct SendPushedResponse
struct SendPushedResponse<B: Buf> { ... }
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 stream will be reset.
See module level docs for more details.
Implementations
impl<B: Buf> SendPushedResponse<B>
fn send_response(self: &mut Self, response: Response<()>, end_of_stream: bool) -> Result<SendStream<B>, Error>Send a response to a promised request.
On success, a
SendStreaminstance 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
SendStreaminstance, thenend_of_streammust be set tofalsewhen calling this function.The
SendPushedResponseinstance is associated with a promised request. This function may only be called once per instance and only ifsend_resethas not been previously called.fn send_reset(self: &mut Self, reason: Reason)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 tosend_responsewill result in an error.If this function is called while a
SendStreaminstance is active, any further use of the instance will result in an error.This function should only be called once.
fn poll_reset(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<Reason, Error>>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 aRST_STREAMis received.If a
RST_STREAMframe is received for this stream, calling this method will yield theReasonfor the reset.Error
Calling this method after having called
send_responsewill return a user error.fn stream_id(self: &Self) -> StreamIdReturns the stream ID of the response stream.
Panics
If the lock on the stream store has been poisoned.
impl<B> Freeze for SendPushedResponse<B>
impl<B> RefUnwindSafe for SendPushedResponse<B>
impl<B> Send for SendPushedResponse<B>
impl<B> Sync for SendPushedResponse<B>
impl<B> Unpin for SendPushedResponse<B>
impl<B> UnsafeUnpin for SendPushedResponse<B>
impl<B> UnwindSafe for SendPushedResponse<B>
impl<B: Buf + fmt::Debug> Debug for SendPushedResponse<B>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Any for SendPushedResponse<B>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for SendPushedResponse<B>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for SendPushedResponse<B>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for SendPushedResponse<B>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for SendPushedResponse<B>
impl<T> WithSubscriber for SendPushedResponse<B>
impl<T, U> Into for SendPushedResponse<B>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for SendPushedResponse<B>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for SendPushedResponse<B>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>