cargo

Rust cargo new

Create a fresh package in an unused directory. Select an edition explicitly so the lesson does not depend on defaults. Example format: shell; manual demonstration; see prerequisites and scope below. Expected result (not executed): New receipt-demo/Cargo.toml and src/main.rs. Why: Cargo initializes a binary package; --vcs none avoids creating a repository. Common mistake: Running this where an existing directory already has that name.

Formal Syntax & Structure

rust syntaxrust
cargo new [OPTIONS]

Working Example

Example Snippetrust
cargo new --edition 2024 --vcs none receipt-demo
Rust Reference