Cargo.toml is the TOML manifest for a Cargo project. `cargo new` creates one alongside `src/main.rs` for an application or `src/lib.rs` for a library. Use it to declare package metadata, dependencies, and project-level build settings. section 2.1.2 section 2.2
Listing 2.1 A minimal Cargo.toml
[package] name = "simple-project" version = "0.1.0" authors = ["Brenden Matthews <brenden@brndn.io>"] edition = "2018" [dependencies] rand = "0.8"
A minimal manifest shows `[package]` metadata and a `[dependencies]` entry for `rand`. section 2.2
Choose the manifest entry that matches the job:
- Put crates used by the project under `[dependencies]`. Version strings follow SemVer requirements; without an explicit operator, Cargo uses caret requirements. `cargo add rand` can add a dependency, while `cargo update` refreshes Cargo.lock within the declared requirements. Pin exact versions when necessary, but consider conflicts for downstream libraries. section 2.2
- For a multi-crate workspace, add a member path under `[workspace]` and declare any needed path dependency separately. Workspace members share the top-level Cargo.lock, target directory, and top-level patch, replace, and profile settings. section 2.10
- Put crates needed by a top-level `build.rs` under `[build-dependencies]`. The build script is compiled Rust, not interpreted code; it can compile C code or perform other build-time operations. section 2.11
- Use a path or Git dependency to work with a modified direct dependency. Use `[patch.crates-io]` when an indirect registry dependency needs replacing, but do not expect consumers of your crate to inherit that patch. section 2.4 section 2.4.1
A workspace member is also a dependency
A top-level manifest can contain `[dependencies]` with `subproject = { path = "./subproject" }` and `[workspace]` with `members = ["subproject"]`. Membership groups the crates; the path entry declares the dependency the application uses. Run `cargo check` to verify the setup. section 2.10
For a published crate, `[package]` can also include `documentation = "https://docs.rs/dryoc"` so visitors can find its documentation. Keep the manifest’s declarations aligned with how the project is built and consumed. section 2.8 section 2.10



