2.9. Configuring Rust project dependencies
Configure the dependencies of your Rust project by using the Cargo build tool. To specify dependencies for a project managed by Cargo, edit the file Cargo.toml in the project directory and rebuild your project. Cargo downloads the Rust code packages and their dependencies, stores them locally, builds all of the project source code including the dependency code packages, and runs the resulting executable.
Prerequisites
Procedure
In your project directory, edit the
Cargo.tomlfile, and list each dependency in the following format in the[dependencies]section:<crate_name> = <version>Rust code packages are called crates.
Rebuild your project:
$ cargo buildRun your project:
$ cargo run