Skip to main content

map_reduce

Function map_reduce 

Source
pub async fn map_reduce<I, T, F, Fut>(
    items: Vec<I>,
    options: ParallelOptions,
    f: F,
) -> Result<ParallelOutcome<T>>
where F: Fn(usize, I) -> Fut, Fut: Future<Output = Result<T>>,
Expand description

Runs f over items concurrently (bounded by ParallelOptions::max_concurrency), collecting per-item outcomes in input order and applying the configured FailurePolicy.

f receives each item’s input index and the item, and returns a future yielding Result<T>. The mapping is deterministic in input order regardless of completion order.

§Errors