1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Test-only serialisation of the process environment.
//!
//! Rust 2024 made `std::env::set_var`/`remove_var` `unsafe` because the
//! environment is process-global while the test harness runs tests on
//! parallel threads. Every env mutation in this crate's tests goes through
//! [`lock`] and [`set`] — one lock for the whole test binary, held for as
//! long as the test reads env vars — so the safety argument lives in exactly
//! one place. Both test modules (`host`, `handlers`) share this lock: a
//! per-module mutex would leave two threads free to mutate the environment
//! at once.
use ;
static ENV: = new;
/// Lock the process environment for this test.
///
/// Hold the returned guard for the whole test, including any reads that
/// would otherwise race a sibling's mutation.
pub
/// Set `key` to the path `value` while the environment is locked.
///
/// The caller must hold the [`lock`] guard for as long as it reads env vars.
pub
/// Remove `key` while the environment is locked.
///
/// The caller must hold the [`lock`] guard for as long as it reads env vars.
pub