Rust CLI Cheat Sheet/Add a named binary target

Expose an extra executable from the same package.

Section: Manifest basics

Add a named binary target

toml
toml
[[bin]]
name = "admin-tool"
path = "src/bin/admin-tool.rs"
Explanation

Binary packages can expose additional executables with `[[bin]]` targets.

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
Pin minimum Rust version
Require a minimum supported compiler version.
OpenIn sheettomlsame section
Add dependencies table
Declare crate dependencies in the manifest.
OpenIn sheettomlsame section
Locate the manifest
Print the path to the Cargo.toml file Cargo will use.
OpenIn sheetbash2 tag match
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