Function powerpack::env::var [−][src]
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 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.
Panics
This function may panic if key is empty, contains an ASCII equals sign '='
or the NUL character '\0'
, or when the value contains the NUL character.