[][src]Function envmnt::is_or

pub fn is_or(key: &str, 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)
  • 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);

    let flag_value = envmnt::is_or("FLAG_VAR", false);
    println!("Bool Flag: {}", &flag_value);
}