🛠️Cargo
Also known as Cargo Rust, Rust Package Manager, Cargo.toml, crates.io
The tool that fetches packages and builds code for the Rust language.
Think of it like
It is like a helper who gets the parts, builds the toy and wraps it.
Example
Jack starts a Rust project with cargo new. He adds one crate to Cargo.toml, and cargo run fetches it, builds and runs.
Why it matters
Definition
Example code
console
$ cargo new hello
$ cd hello
$ cargo run
Hello, world!Common mistake
Key takeaways
- 1Fetch. It downloads crates from crates.io.
- 2Build and run. One command builds, runs or tests.
- 3Cargo.toml. One file lists the whole project.