Skip to main content

env_var

Function env_var 

Source
pub fn env_var(var: impl AsRef<OsStr>) -> Result<String>
Expand description

Like std::env::var, but treat not-set as empty string. Tracing and reporting is built-in.

If you need to detect the case where the env var is not set, use std::env::var directly.

assert!(!cu::env_var("CARGO")?.is_empty());
assert!(cu::env_var("NOT_SET")?.is_empty());