pub fn parallel_reduce<T>(
items: &[T],
f: impl Fn(T, T) -> T + Send + Sync + 'static,
identity: T,
) -> TExpand description
Reduce items to a single value using f with the given identity element.
Fans out the reduction into chunks (one per available hardware thread), reduces each chunk sequentially, then combines the chunk results.
§Type constraints
T: Clone + Send + Sync– items and identity must be cloneable and thread-safe.f: Fn(T, T) -> T + Send + Sync– the combining function must be thread-safe.