select_handles

Functionin handlefastly 0.13.1View source
fn select_handles<I>(pending_reqs: I) -> (Result<(ResponseHandle, BodyHandle), SendErrorCause>, usize, Vec<PendingRequestHandle>)
where
I: IntoIterator<Item = PendingRequestHandle>,

Given a collection of PendingRequestHandles, block until the result of one of the handles is ready.

This function accepts any type which can become an iterator that yields handles; a common choice is Vec<PendingRequestHandle>.

Returns a tuple (result, index, remaining), where:

  • result is the result of the handle that became ready.

  • index is the index of the handle in the argument collection (e.g., the index of the handle in a vector) that became ready.

  • remaining is a vector containing all of the handles that did not become ready. The order of the handles in this vector is not guaranteed to match the order of the handles in the argument collection.

Panics

Panics if the argument collection is empty, or contains more than fastly_shared::MAX_PENDING_REQS handles.

Parameters

pending_reqs: I

Returns

(Result<(crate::handle::ResponseHandle, crate::handle::BodyHandle), crate::http::request::SendErrorCause>, usize, Vec<PendingRequestHandle>)