Skip to main content

## crate_name

# Macro crate_name

Source

    macro_rules! crate_name {
        () => { ... };
    }

Available on crate feature `cargo` only.
Expand description

Allows you to pull the name from your Cargo.toml at compile time.

NOTE: This macro extracts the name from an environment variable `CARGO_PKG_NAME`. When the crate name is set to something different from the package name, use environment variables `CARGO_CRATE_NAME` or `CARGO_BIN_NAME`. See the Cargo Book for more information.

## §Examples

    let m = Command::new(crate_name!())
                .get_matches();