pub fn decrement<K: AsRef<OsStr>>(key: K) -> isize
Expand description

Decrements and returns the new value stored by the given environment variable key. In case the variable does not exist, it will decrement to -1. The updated value will be returned.

Arguments

  • key - The environment variable name

Example

fn main() {
    envmnt::set_u8("ENV_VAR", 5);
    let value = envmnt::decrement("ENV_VAR");
    assert_eq!(value, 4);
}