Cargo is Rust's package and dependency manager, like Bundler, npm, pub, or pip for other languages. Although you can write Rust programs without it, Cargo is nearly indispensable for any larger project. It works the same whether you work on a Windows, Linux, or OS X system. The installation procedure from the previous section includes the Cargo tool, cargo, so Rust is shipped with the batteries included.
Cargo does the following things for you:
- It makes a tidy folder structure and some templates for your project, with the following command:
cargo new
- It compiles (builds) your code, using the following command:
cargo build
- It runs your project, using the following command:
cargo run
- If your project contains unit-tests, ...