cargo-manifest

Rust Feature flags

Features select conditional compilation choices at build time. Design them as additive capabilities when possible; they are not runtime preferences. Example format: toml; run from a disposable copy of v15/fixtures/projects/feature-app. Expected result (not executed): cargo run --offline --quiet --features friendly prints Welcome. Why: The feature enables the local label dependency and the matching cfg branch. Common mistake: Expecting to switch a compiled feature from a runtime menu.

Formal Syntax & Structure

rust syntaxrust
[features]; cargo run --features NAME

Working Example

Example Snippetrust
[features]default = ["friendly"]friendly = ["dep:label"]
Rust Reference