pub struct Env { /* private fields */ }Expand description
Environment variables, looked up by name.
Implementations§
Source§impl Env
impl Env
Sourcepub fn search_dirs(&self) -> Vec<PathBuf>
pub fn search_dirs(&self) -> Vec<PathBuf>
The directories on PATH a program is searched in, in order: only
absolute ones. An empty or relative entry would be resolved against
cuno’s working directory, often the project, which can hold a file
named like the program (docs/en/specs/toolchain.md, “LLVM
(clang / clang-cl / clang-format / clang-tidy)”).
Sourcepub fn case(&self) -> NameCase
pub fn case(&self) -> NameCase
How this environment’s names are compared, which is how the system it came from compares file names too.
Sourcepub fn from_process() -> Env
pub fn from_process() -> Env
The environment of the running process. Only the binary calls this.
Sourcepub fn from_pairs(
pairs: impl IntoIterator<Item = (OsString, OsString)>,
case: NameCase,
) -> Env
pub fn from_pairs( pairs: impl IntoIterator<Item = (OsString, OsString)>, case: NameCase, ) -> Env
An environment holding exactly pairs, with names compared as case
says; a later pair replaces an earlier one with the same name.
Sourcepub fn set_value(&self, name: &str) -> Option<&OsStr>
pub fn set_value(&self, name: &str) -> Option<&OsStr>
The value of cuno’s own variable name (CUNO_HOME and the like),
or None when it is unset or empty: an empty one counts as unset
(docs/en/specs/manifest.md, “Two levels of settings”). Not for
NO_COLOR, which is set even when empty.
Sourcepub fn vars(&self) -> impl Iterator<Item = (&OsStr, &OsStr)>
pub fn vars(&self) -> impl Iterator<Item = (&OsStr, &OsStr)>
Every variable, as (name as spelled, value), for giving a child process exactly this environment.