Function powerpack_env::var

source ·
pub fn var<K: AsRef<OsStr>>(key: K) -> Option<String>
Expand description

Fetches the environment variable key from the current process.

This function is similar to std::env::var(key).ok() but it also maps an empty string to None.

None

Returns None in the following cases:

  • if the environment variable is not present.
  • if the environment variable is not valid Unicode.
  • if the environment variable is set to an empty string.