Function temp_env::with_var[][src]

pub fn with_var<K, V, F>(key: K, value: Option<V>, closure: F) where
    K: AsRef<OsStr> + Clone + Eq + Hash,
    V: AsRef<OsStr> + Clone,
    F: Fn() + UnwindSafe + RefUnwindSafe
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.