Function fastly::handle::select_handles [−][src]
pub fn select_handles<I>(
pending_reqs: I
) -> (Result<(ResponseHandle, BodyHandle), SendErrorCause>, usize, Vec<PendingRequestHandle>) where
I: IntoIterator<Item = PendingRequestHandle>,
Expand description
Given a collection of PendingRequestHandle
s, 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.