PendingRequestHandle
pub struct PendingRequestHandle { /* private fields */ }A handle to a pending asynchronous request returned by
RequestHandle::send_async() or
RequestHandle::send_async_streaming().
A handle can be evaluated using PendingRequestHandle::poll(),
PendingRequestHandle::wait(), or select_handles(). It
can also be discarded if the request was sent for effects it might have, and the response is
unimportant.
Methods
append_response_header
View sourcefn append_response_header(&self, name: impl ToHeaderName, value: impl ToHeaderValue, target: PendingResponseKind)Append a header on the Response once it is ready, leaving any existing entries of the
same name in place.
Parameters
- self: &Self
- name: impl ToHeaderName
- value: impl ToHeaderValue
- target: PendingResponseKind
as_u32
View sourcefn as_u32(&self) -> u32Get the underlying representation of the handle.
This should only be used when calling the raw ABI directly, and care should be taken not to reuse or alias handle values.
Parameters
- self: &Self
Returns
poll
View sourcefn poll(self) -> PollHandleResultTry to get the result of a pending request without blocking.
This function returns immediately with a PollHandleResult; if you want to block until a
result is ready, use wait().
Parameters
- self: Self
Returns
remove_response_header
View sourceRemove a header from the Response once it is ready.
Parameters
- self: &Self
- name: impl ToHeaderName
- target: PendingResponseKind
send_to_client
View sourcefn send_to_client(self)Move processing of the PendingRequestHandle to the background and forward its eventual response to the downstream client.
If an error is encountered while sending the request (for example, a SendErrorCause::ConnectionRefused due to the server being unavailable), then an appropriate 5XX response will be sent instead.
Using this allows the sandbox to terminate early so that its resources may be freed up for other incoming requests.
Parameters
- self: Self
set_response_header
View sourcefn set_response_header(&self, name: impl ToHeaderName, value: impl ToHeaderValue, target: PendingResponseKind)Set a header on the Response once it is ready, replacing any existing entries of the same
name.
Parameters
- self: &Self
- name: impl ToHeaderName
- value: impl ToHeaderValue
- target: PendingResponseKind
wait
View sourceBlock until the result of a pending request is ready.
If you want check whether the result is ready without blocking, use
poll().
Parameters
- self: Self
Returns