pub fn parallel_map<T, R>(
items: &[T],
f: impl Fn(&T) -> R + Send + Sync + 'static,
) -> Vec<R>Expand description
Apply f to every item in items in parallel and return the results.
Uses std::thread::spawn to fan out work across chunks, then collects
results in the original order.
ยงType constraints
T: Send + Syncโ items must be shareable across threads.R: Sendโ results must be sendable back to the main thread.f: Fn(&T) -> R + Send + Syncโ the closure must be thread-safe.