pub fn for_each<I, F, T>(i: I, f: F)
Expand description
Calls the closure on each element of the iterator in parallel, waiting for all closures to finish.
- The closure does not require
'static
lifetime since thefor_each
function bounds the lifetime of all submitted closures. - The closure must be
Sync
as multiple threads will refer to it. - The iterator items must be
Send
as they will be sent from one thread to another.