Function git_features::parallel::in_parallel [−][src]
pub fn in_parallel<I, S, O, R>(
input: impl Iterator<Item = I> + Send,
thread_limit: Option<usize>,
new_thread_state: impl Fn(usize) -> S + Send + Sync,
consume: impl Fn(I, &mut S) -> O + Send + Sync,
reducer: R
) -> Result<<R as Reducer>::Output, <R as Reducer>::Error> where
R: Reducer<Input = O>,
I: Send,
O: Send,
Read items from input
and consume
them, producing an output to be collected by a reducer
, whose task is to
aggregate these outputs into the final result returned by this function.
- if
thread_limit
isSome
, the given amount of threads will be used. IfNone
, all logical cores will be used. new_thread_state(thread_number) -> State
produces thread-local state once per thread to be based toconsume
consume(Item, &mut State) -> Output
produces an output given an input obtained byinput
along with mutable state initially created bynew_thread_state(…)
.- For
reducer
, see theReducer
trait