cargo-run
Build and execute a local package binary
TLDR
Build and run project
SYNOPSIS
cargo run [options] [-- args]
DESCRIPTION
cargo run builds and executes a binary target of the current package. It automatically recompiles the project when source files have changed, then runs the resulting executable. Any arguments placed after `--` are forwarded directly to the binary rather than being interpreted by Cargo.
If the package contains multiple binary targets, a specific one must be selected with `--bin` or `--example`, or a default can be configured via the `default-run` field in Cargo.toml. The binary's working directory is set to the current shell directory.
PARAMETERS
--bin name
Run specified binary--example name
Run specified example-r, --release
Run with release profile optimizations--profile name
Build with specific profile-p, --package spec
Run from specified package--target triple
Run for target platform-j, --jobs n
Parallel build jobs--features features
Enable specified features--all-features
Enable all features--no-default-features
Disable default features-v, --verbose
Verbose output
WORKING DIRECTORY
Sets binary working directory to current directory (same as shell execution).
DEFAULT BINARY
Set default-run in Cargo.toml [package] section to choose default binary.
CAVEATS
Errors if multiple binaries exist without --bin flag. Use default-run manifest key to set default.
SEE ALSO
cargo(1), cargo-build(1), cargo-test(1)
