pub fn get_or_panic<K: AsRef<OsStr>>(key: K) -> String
Expand description

Returns the environment variable value. If the variable is not defined, this function will panic.

Arguments

  • key - The environment variable name

Example

fn main() {
    envmnt::set("MY_ENV_VAR", "SOME VALUE");
    assert!(envmnt::is_equal("MY_ENV_VAR", "SOME VALUE"));

    let value = envmnt::get_or_panic("MY_ENV_VAR");
    assert_eq!(value, "SOME VALUE");
}