Module lessons (2/3)
Cargo.toml, Crate, Feature Flags and SemVer
Anatomy of Cargo.toml and Cargo.lock, release vs dev profile, configuring dependencies (serde) and conditional features.
What you'll learn in this lesson
- Distinguish the difference between Package, Binary/Library Crate, and the role of
Cargo.tomlvsCargo.lock. - Handle versions with SemVer, profiles (
devvs--release), and compiler optimizations. - Enable conditional code and optional modules via
#[cfg(feature = "...")].
Overview
Cargo is Rust's official package manager and build tool: it downloads dependencies from crates.io, compiles the entire crate graph, runs tests, generates documentation (cargo doc), and manages multi-package workspaces.
A typical project has a manifest Cargo.toml that declares optional metadata, dependencies, and feature flags:
Sections covered in this lesson
- 11. Anatomy of
Cargo.tomland SemVer - 22.
Cargo.lock: 100% playable builds - 33.
devvs--releaseprofiles and conditional compilation - 44. Multi-crate workspaces and build profiles
- 5Practical exercises
- 6Check for understanding
Unlock "Cargo.toml, Crate, Feature Flags and SemVer" and the full Course Rust curriculum
Anatomy of `Cargo.toml` and `Cargo.lock`, release vs dev profile, configuring dependencies (`serde`) and conditional features.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Course Rust plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.