Rust CLI Cheat Sheet/Add dependencies table

Declare crate dependencies in the manifest.

Section: Manifest basics

Add dependencies table

toml
toml
[dependencies]
clap = { version = "4", features = ["derive"] }
anyhow = "1"
Explanation

Dependencies are normally declared in the `[dependencies]` table.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Manifest basics
Minimal package manifest
Define package metadata and edition.
OpenIn sheettomlsame section
Add a named binary target
Expose an extra executable from the same package.
OpenIn sheettomlsame section
Pin minimum Rust version
Require a minimum supported compiler version.
OpenIn sheettomlsame section
Create a new binary crate
Generate a new package for an executable.
OpenIn sheetbash1 tag match
Show Cargo help
Display top-level help for Cargo.
OpenIn sheetbash1 tag match
Create a new library crate
Generate a reusable library package.
OpenIn sheetbash1 tag match