0PricingLogin
Learn Rust Coding · Lesson

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.toml manifest
  • 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_app makes a binary crate
  • cargo new my_lib --lib makes a library crate
cargo new my_app
cd my_app

All lessons in this course

  1. Cargo Basics
  2. Cargo.toml
  3. Workspaces
  4. Features and Profiles
← Back to Learn Rust Coding