[][src]Macro cargo_emit::rustc_env

macro_rules! rustc_env {
    ($var:expr, $value:expr $(, $($args:tt)*)?) => { ... };
}

Tells Cargo to assign $var for the environment variable for $key.

This is equivalent to:

println!("cargo:rustc-env=$var=$value");

Examples

Useful for injecting environment variables during the build.

The $var and $value parameters get concatenated into a single formatting string. Formatting runtime values can be done by passing subsequent values.

let git_rev_hash = //
cargo_emit::rustc_env!("MY_HASH", "{}", git_rev_hash);