[][src]Attribute Macro realia::env

#[env]

Checks whether an environment variable is defined and optionally what value it has.

If you use this attribute, your project should include a build.rs that triggers a rebuild when any environment variables of interest change:

fn main() {
    // Necessary when using #[realia::env("FOO")]
    println!("cargo:rerun-if-env-changed=FOO");
}

Example

#[realia::env("CI")]
fn example() {
    println!("CI is defined");
}
#[realia::env("CI", "true")]
fn example() {
    println!("CI is set to true");
}