[][src]Function envmnt::is_or

pub fn is_or<K: AsRef<OsStr>>(key: K, default_value: bool) -> bool

Returns false if environment variable value if falsy. The value is falsy if it is one of the following:

  • Empty string
  • "false" (case insensitive)
  • "no" (case insensitive)
  • "0" Any other value is returned as true.

Arguments

  • key - The environment variable name
  • default_value - In case the environment variable is not defined, this value will be returned.

Example

extern crate envmnt;

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);
}