Follow these steps to download and set up a rayon crate in your project:
- We will require the Rust compiler and any text editor for developing the Rust code snippet.cargo.
- Create a new Cargo project named sample_rayon using:
cargo new sample_rayon --bin
You will get the following screenshot as output:
- Enter the newly created sample_rayon project and check whether the structure is created properly:
cd sample_rayon/ && tree .
You will get the following output:
- Open the Cargo.toml file to download the rayon crate using:
nano Cargo.toml
- Enter the following values in the dependencies tag:
- Build the project again to download the rayon crate:
cargo build
You will get the following screenshot as output:
- Check the file structure to see the dependencies installed:
ls && tree .
You will get the following screenshot as output: