cargo

Rust cargo metadata

Read package information as structured JSON for tooling. Request an explicit output format and parse JSON rather than terminal text. Example format: shell; run from a disposable copy of v15/fixtures/projects/local-app. Expected result (not executed): A JSON object describing the local graph; paths and IDs vary. Why: The metadata includes package and dependency information. Common mistake: Assuming machine-specific paths are identical across runs.

Formal Syntax & Structure

rust syntaxrust
cargo metadata [OPTIONS]

Working Example

Example Snippetrust
cargo metadata --offline --format-version 1
Rust Reference