A small question about Rayon. If I have code similar to:
(1 .. 100).map(|x| x * x).sum()
I'd like to compute it in parallel, something like:
(1 .. 100).par_iter().map(|x| x * x).sum()
Do you know what's the correct Rayon usage syntax?
A small question about Rayon. If I have code similar to:
(1 .. 100).map(|x| x * x).sum()
I'd like to compute it in parallel, something like:
(1 .. 100).par_iter().map(|x| x * x).sum()
Do you know what's the correct Rayon usage syntax?
This should work:
use rayon::par_iter::{IntoParallelIterator, ParallelIterator};
(1 .. 100).into_par_iter().map(|x| x * x).sum()
General tip: posting the exact code you're using and, importantly, the error messages you see helps people help you.