Skip to main content

map_jobs

Function map_jobs 

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

Maps f over items across at most jobs scoped worker threads, keeping the results in input order.

Chunked rather than work-stealing: the callers map over module definitions, whose per-item cost is uneven but whose counts are small.

wasm has no threads, so it always runs serially.

ยงPanics

Panics if f panics in a worker thread.