Function git_repository::parallel::in_parallel_with_slice
source · [−]pub fn in_parallel_with_slice<I, S, E>(
input: &[I],
thread_limit: Option<usize>,
new_thread_state: impl FnMut(usize) -> S + Send + Clone,
consume: impl FnMut(&I, &mut S) -> Result<(), E> + Send + Clone,
periodic: impl FnMut() -> Option<Duration> + Send
) -> Result<Vec<S, Global>, E> where
I: Send + Sync,
E: Send + Sync,
S: Send,
Expand description
An experiment to have fine-grained per-item parallelization with built-in aggregation via thread state.
This is only good for operations where near-random access isn’t detremental, so it’s not usually great
for file-io as it won’t make use of sorted inputs well.
Note that periodic
is not guaranteed to be called in case other threads come up first and finish too fast.