[][src]Function fastly::request::select

pub fn select<I>(
    pending_reqs: I
) -> (Result<Response<Body>, Error>, usize, Vec<PendingRequest>) where
    I: IntoIterator<Item = PendingRequest>, 

Given a collection of PendingRequests, block until the result of one of the requests is ready.

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

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

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

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

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

Panics

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