Skip to main content

env_flag_enabled

Function env_flag_enabled 

Source
pub fn env_flag_enabled(var_name: &str) -> bool
Expand description

Whether the environment variable var_name is set to an affirmative flag.

Accepts 1, true, yes, on, or debug (case-insensitive, surrounding whitespace ignored). This is the canonical env-flag parser; do not fork the accepted-value set per crate.

// Unset variables are disabled.
assert!(!env_flag_enabled("VTCODE_ENV_FLAG_DOCTEST_DEFINITELY_UNSET"));