Cargo Basics
Build and run.
What Is Cargo?
Cargo is Rust's build system and package manager. It compiles your code, downloads dependencies, runs tests, and builds documentation.
- Comes bundled with the Rust toolchain
- Manages a project's
Cargo.tomlmanifest - Handles the whole build lifecycle for you
Creating a New Project
Use cargo new to scaffold a binary project. It creates a directory with a src/main.rs and a Cargo.toml.
cargo new my_appmakes a binary cratecargo new my_lib --libmakes a library crate
cargo new my_app
cd my_appAll lessons in this course
- Cargo Basics
- Cargo.toml
- Workspaces
- Features and Profiles