envc!() { /* proc-macro */ }
Expand description

Inspects and encrypts an environment variable at compile time and decrypts at runtime.

This macro will expand to the value of the named environment variable at compile time, yielding an expression of type String. Use std::env::var instead if you want to read the value at runtime.

let path: String = envc!("PATH");
println!("the $PATH variable at the time of compiling was: {path}");

If the environment variable is not defined, then a compilation error will be emitted. To not emit a compile error, use the option_envc! macro instead.

let unlikely_variable: String = envc!("HIGHLY_UNLIKELY_ENVIRONMENT_VARIABLE");