Declare named features in the manifest.

Section: Features

Define package features

toml
toml
[features]
default = ["color"]
color = []
json = ["dep:serde_json"]
Explanation

Cargo features enable or disable optional functionality.

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 Features
Build with selected features
Enable one or more package features.
OpenIn sheetbashsame section
Disable default features
Build or test without defaults.
OpenIn sheetbashsame section
Enable all features
Build everything gated by features.
OpenIn sheetbashsame section
Minimal workspace root
Define workspace members from a root manifest.
OpenIn sheettoml2 tag match
Add a crates.io dependency
Use a semantic version requirement.
OpenIn sheettoml1 tag match
Use a git dependency
Pin a crate directly from a Git repository.
OpenIn sheettoml1 tag match