Registry / testing / temp-env

temp-env

JSON →
library0.3.6rscratesunverified

Set environment variables temporarily for the duration of a closure or scope.

# Cargo.toml [dependencies] temp-env = "0.3.6"
INSTALL
IMPORT
SIG · TEMP-ENV
T
temp-env
testingrustv0.3.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

with_var
use temp_env::with_var;

Sets MY_VAR temporarily and prints it inside the closure.

use temp_env::with_var; fn main() { with_var("MY_VAR", Some("temp_value"), || { println!("MY_VAR = {:?}", std::env::var("MY_VAR")); }); // After closure, MY_VAR is restored }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.3.6latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
4
Amazon
1
Resources
temp-env — cargo add temp-env · libregistry