pub struct SendPushedResponse<B: Buf> { /* private fields */ }
Expand description
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§
Source§impl<B: Buf> SendPushedResponse<B>
impl<B: Buf> SendPushedResponse<B>
Sourcepub fn send_response(
&mut self,
response: Response<()>,
end_of_stream: bool,
) -> Result<SendStream<B>, Error>
pub fn send_response( &mut self, response: Response<()>, end_of_stream: bool, ) -> Result<SendStream<B>, Error>
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.
Sourcepub fn send_reset(&mut self, reason: Reason)
pub fn send_reset(&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 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.
Sourcepub fn poll_reset(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Reason, Error>>
pub fn poll_reset( &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 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.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for SendPushedResponse<B>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes