Function envmnt::set_optional
source · [−]Expand description
Sets the environment variable if the provided option contains a value.
Arguments
key
- The environment variable namevalue
- The optional value to set
Example
fn main() {
let output = envmnt::set_optional("MY_ENV_VAR", &Some("OPTIONAL VALUE"));
assert!(output);
assert!(envmnt::is_equal(
"MY_ENV_VAR",
"OPTIONAL VALUE"
));
}