I’ve got a process like this:
find_items_to_process_iter() // .into_par_iter() // not implemented in rayon :( // .collect().into_par_iter() // bad, waits too long .map(process_item) .collect::<Result<_>>()?
find_items_to_process_iter is I/O-bound and takes long time to complete. The
process_item is CPU-bound. Ideally I’d like items to be processed, in parallel, as soon as they’re found, while searching is still on.
I guess I need some kind of thread pool? But if I just chuck processing to a pool, then how do I collect the results and check for errors?