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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use BTreeMap;
use OsString;
/// Environment map used by the detector.
///
/// This is the input type consumed by [`detect_from_env`] and
/// [`detect_with_options`]. Keys and values are stored as `OsString` to match
/// how the OS represents environment variables, and callers can construct their own detection
/// inputs. A `BTreeMap` is used so iteration is stable for debugging and tests.
///
/// Lookup is case-sensitive on Unix and ASCII case-insensitive on Windows. A synthetic Windows
/// snapshot with duplicate spellings prefers an exact match. Diagnostic keys use the detector's
/// canonical spelling. Values remain OS strings here, but detection results decode them lossily.
///
/// # Example
///
/// ```rust
/// use detect_terminal::EnvMap;
///
/// let env: EnvMap = std::env::vars_os().collect();
/// let info = detect_terminal::detect_from_env(&env);
/// println!("Terminal: {}", info.kind);
/// ```
///
/// [`detect_from_env`]: crate::detect_from_env
/// [`detect_with_options`]: crate::detect_with_options
/// [`EnvMap`]: crate::EnvMap
/// [`TerminalInfo::raw_env_subset`]: crate::TerminalInfo::raw_env_subset
pub type EnvMap = ;
/// Read-only view of the environment with optional capture of accessed keys.
///
/// This is used by the detector to record the specific variables read while
/// still performing lookups from the original map. Captured keys become
/// [`TerminalInfo::raw_env_subset`] so callers can audit which markers were
/// queried.
///
/// [`TerminalInfo::raw_env_subset`]: crate::TerminalInfo::raw_env_subset
pub
/// Build an environment map from the current process.
///
/// This collects [`std::env::vars_os`] into the [`EnvMap`] used by the detector.
pub