Skip to main content

map_ordered

Function map_ordered 

Source
pub fn map_ordered<T, R>(
    items: &[T],
    f: impl Fn(usize, &T) -> R + Sync,
) -> Vec<R>
where T: Sync, R: Send,
Expand description

Map f over items on up to threads scoped threads, returning results in item order. f receives the item index and the item.

Determinism holds by construction: items are computed independently and results placed by index, so the output is identical at any thread count. The caller’s progress watch is re-installed in every worker; f may checkpoint through it.