pub fn with_var<K, V, F, R>(key: K, value: Option<V>, closure: F) -> R
Expand description
Sets a single environment variable for the duration of the closure.
The previous value is restored when the closure completes or panics, before unwinding the panic.
If value
is set to None
, then the environment variable is unset.