PendingRequestHandle

Structin handlefastly 0.13.1View source
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 source
fn 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
fn as_u32(&self) -> u32

Get 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

u32
fn poll(self) -> PollHandleResult

Try 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 source
fn remove_response_header(&self, name: impl ToHeaderName, target: PendingResponseKind)

Remove a header from the Response once it is ready.

Parameters

self: &Self
name: impl ToHeaderName
target: PendingResponseKind

send_to_client

View source
fn 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 source
fn 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

Block 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

Trait implementations

impl Debug for PendingRequestHandle

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Parameters

self: &Self
f: &mut $crate::fmt::Formatter

Returns

$crate::fmt::Result

impl From<PendingRequest> for PendingRequestHandle

fn from(pr: PendingRequest) -> Self

Parameters

pr: PendingRequest

Returns

Self

impl Hash for PendingRequestHandle

fn hash<__H: Hasher>(&self, state: &mut __H)

Parameters

self: &Self
state: &mut __H

impl PartialEq for PendingRequestHandle

fn eq(&self, other: &Self) -> bool

Parameters

self: &Self
other: &Self

Returns

bool

Auto trait implementations

Blanket implementations