[go: up one dir, main page]

set_bool

Function set_bool 

Source
pub fn set_bool<K: AsRef<OsStr>>(key: K, value: bool)
Expand description

Sets the environment variable with a true/false value as string.

§Arguments

  • key - The environment variable name
  • value - true/false boolean value which will be converted to string

§Example

fn main() {
    envmnt::set_bool("FLAG_VAR", true);
    assert!(envmnt::is_equal("FLAG_VAR", "true"));

    let flag_value = envmnt::is_or("FLAG_VAR", false);
    assert!(flag_value);
}