pub fn run<X: Send, Y: Send, E: Send>(
xs: impl IntoIterator<Item = X>,
threads: usize,
f: impl Fn(X) -> Result<Y, E> + Sync,
report: impl FnMut(Y) -> Result<(), E> + Send
) -> Result<usize, E>
Expand description
Compute f(x)
for every x
in xs
using thread pool and call report
for every result and preserve order of elements.
Retutns either number of elements successfully processed or first enocuntered error.
Number of threads in the workers pool will be equal to threads
.