Rust's Vec is a great data structure that is used not only for holding data but also as a management tool of sorts. In an earlier recipe (Managing multiple threads) in this chapter, we saw that when we captured the handles of multiple threads in Vec and then used the map() function to join them. This time, we are going to focus on concurrently processing regular Vec instances without additional overhead. In the previous recipe, we saw the power of rayon-rs and now we are going to use it to parallelize data processing.
Concurrent data processing in vectors
How to do it...
Let's use rayon-rs some more in the following steps:
- Create a new project using cargo new concurrent-processing --lib and open it in Visual Studio...