I am trying to turn the code below into a parallel iterator to speed up performance:
// something like this
string.split(" ").enumerate().into_par_iter().for_each(|(_, b)| {
// do something
});
But Rayon doesn't support .into_par_iter()
for the Enumerate
struct. And being relatively new to Rust, I'm not sure how to fix this problem.
Most of the other problems involve vectors, but it doesn't here as I am trying to do the following:
- Get a string:
String::from("Lorem ipsum dolor sit amet")
- Using
.split(" ").enumerate()
turn it into a vector:vec!["Lorem", "ipsum", "dolor", sit", "amet"]
So how can I turn the code above run in parallel?