[][src]Function envmnt::increment

pub fn increment<K: AsRef<OsStr>>(key: K) -> isize

Increments and returns the new value stored by the given environment variable key. In case the variable does not exist, it will increment 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::increment("ENV_VAR");
    assert_eq!(value, 6);
}