Cargo.toml
Cargo.toml is a TOML-formatted manifest file that declares a Rust package’s metadata, dependencies, targets, and build configuration.
Code Like a Pro in Rust
Cargo.toml is a project manifest and configuration file that specifies metadata and dependencies for a Cargo project.
- How it is used
- Configures Cargo packages, dependencies, workspaces, build dependencies, patches, and documentation links.
- How deep it goes
- Demonstrates common manifest entries and version requirements through practical examples, without presenting an exhaustive manifest reference.
- Examples
- Uses a rand manifest, a workspace subproject, a C build dependency, and a libc registry patch.
- What you can do after
- Operate/configure Cargo manifests to declare dependencies, group workspace crates, and redirect patched dependencies.
Rust Servers, Services, and Apps
Cargo.toml is a manifest file that declares a Rust package's metadata, dependencies, targets, and related Cargo configuration.
- How it is used
- Organizes Rust workspaces, selects project dependencies, and declares executable targets for web services and database applications.
- How deep it goes
- Defines workspace membership, dependencies, feature flags, and binaries through concrete listings, but does not detail manifest syntax broadly.
- Examples
- Uses tutor-nodb and tutor-db workspaces, basic-server binaries, and manifests for Actix Web registration and sqlx database programs.
- What you can do after
- Operate/configure Cargo projects by adding dependencies, selecting features, declaring binaries, and running workspace packages.
Read how Rust Servers, Services, and Apps explains cargo.toml →
Learn Rust in a Month of Lunches
Cargo.toml is the manifest file that declares a Rust package's metadata and dependencies, including external crates and their versions.
- How it is used
- Uses the manifest to declare package details, add external crates, and configure release behavior.
- How deep it goes
- Walks through adding a dependency and shows a release-profile setting, while linking to the manifest reference for more keys.
- Examples
- Shows a manifest with `rand = "0.8.5"` and a release profile that sets `panic = 'abort'`.
- What you can do after
- Operate/configure a Cargo project by adding a dependency and setting release panic behavior.
Read how Learn Rust in a Month of Lunches explains cargo.toml →
Embedded Software with Rust
Cargo.toml is the TOML-formatted manifest file that declares a Rust package's metadata, dependencies, and build configuration.
- How it is used
- Configures embedded Rust packages and their dependencies for hardware constraints and bare-metal builds.
- How deep it goes
- Explains manifest fields, release optimization and feature selection through focused configurations and build commands.
- Examples
- Uses an STM32 firmware manifest and optional semihosting dependencies to demonstrate size optimization and selectable panic behavior.
- What you can do after
- Operate and configure a Cargo manifest to select embedded dependencies, features and release-profile settings.
Rust in Action: Systems programming concepts and techniques
Cargo.toml is a Rust package manifest that declares project metadata and dependencies.
- How it is used
- Coordinates Rust package metadata, dependency fetching, library targets, binary targets, and compilation.
- How deep it goes
- Explains manifest structure through complete examples, but stops short of comprehensive Cargo configuration reference.
- Examples
- Uses Hello World, an in-memory key-value store, a clock command-line tool, and an operating-system project.
- What you can do after
- Operate/configure Cargo by declaring package metadata, dependencies, libraries, and executable targets.
Read how Rust in Action: Systems programming concepts and techniques explains cargo.toml →
Also covered in
What to know first
- crateA crate is a unit of Rust code compiled as a library or executable, comprising source code and its module hierarchy and distributable through package metadata.
- RustRust is a statically typed systems programming language designed for performance, concurrency, and memory safety without requiring garbage collection.
- dependencyA dependency is a component, resource, or prerequisite that another software component or activity relies on to function, build, or proceed.
Related concepts
- development dependencyhas part · A development dependency is a software package needed for development tasks such as building, testing, or debugging, but not normally needed for an application's runtime operation.
- Cargoconfigures · Cargo is Rust’s package manager and build tool for managing projects and dependencies and for building, testing, and running Rust code.
- cargo addconfigured by · cargo add is a Cargo subcommand that adds a dependency declaration and its configuration to a Rust package’s manifest.
Questions about cargo.toml
What is cargo.toml?
Cargo.toml is a TOML-formatted manifest file that declares a Rust package’s metadata, dependencies, targets, and build configuration.
Which Manning books explain cargo.toml?
Code Like a Pro in Rust, Rust Servers, Services, and Apps, Learn Rust in a Month of Lunches, Embedded Software with Rust and Rust in Action: Systems programming concepts and techniques.
What should I know before learning cargo.toml?
Manning books that teach cargo.toml usually introduce crate, Rust and dependency first.
What are the parts of cargo.toml?
Cargo.toml includes development dependency and bin section.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




