Function git_repository::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 Reduce>::Output, <R as Reduce>::Error> where
I: Send,
R: Reduce<Input = O>,
O: Send,
Expand description
Read items from input and consume them in a single thread, producing an output to be collected by a reducer,
whose task is to aggregate these outputs into the final result returned by this function.
new_thread_state(thread_number) -> Stateproduces thread-local state once per thread to be based toconsumeconsume(Item, &mut State) -> Outputproduces an output given an input along with mutable state.- For
reducer, see theReducetrait - if
thread_limithas no effect as everything is run on the main thread, but is present to keep the signature similar to the parallel version.
This serial version performing all calculations on the current thread.