pub struct EnvSnapshot { /* private fields */ }Expand description
The values of every EnvVar and the current directory of one run.
Implementations§
Source§impl EnvSnapshot
impl EnvSnapshot
Sourcepub fn capture() -> EnvSnapshot
pub fn capture() -> EnvSnapshot
Read every variable and the current directory from the process.
Sourcepub fn none() -> EnvSnapshot
pub fn none() -> EnvSnapshot
A snapshot without variables and without a current directory.
Sourcepub fn with_cwd(self, cwd: PathBuf) -> EnvSnapshot
pub fn with_cwd(self, cwd: PathBuf) -> EnvSnapshot
The snapshot with cwd as the current directory.
Sourcepub fn retain(self, keep: impl Fn(EnvVar) -> bool) -> EnvSnapshot
pub fn retain(self, keep: impl Fn(EnvVar) -> bool) -> EnvSnapshot
The snapshot with only the variables that keep accepts. The current
directory stays.
Sourcepub fn set_vars(&self) -> impl Iterator<Item = EnvVar>
pub fn set_vars(&self) -> impl Iterator<Item = EnvVar>
Each variable that has a value, in the order of EnvVar::ALL.
Sourcepub fn cache_dir(&self) -> Option<PathBuf>
pub fn cache_dir(&self) -> Option<PathBuf>
The cache directory of FALLOW_CACHE_DIR, parsed with
crate::cache_dir_from_env_value. An empty value gives None.
Sourcepub fn parse<T>(
&self,
var: EnvVar,
parse: impl FnOnce(&str) -> Option<T>,
) -> Result<Option<T>, EnvProblem>
pub fn parse<T>( &self, var: EnvVar, parse: impl FnOnce(&str) -> Option<T>, ) -> Result<Option<T>, EnvProblem>
The value of var, parsed with parse. Ok(None) is an unset
variable.
§Errors
Returns EnvProblem::NotUnicode for a value that is not valid UTF-8
and EnvProblem::InvalidValue for a value that parse rejects.
Trait Implementations§
Source§impl Clone for EnvSnapshot
impl Clone for EnvSnapshot
Source§fn clone(&self) -> EnvSnapshot
fn clone(&self) -> EnvSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnvSnapshot
impl Debug for EnvSnapshot
Source§impl Default for EnvSnapshot
impl Default for EnvSnapshot
Source§fn default() -> EnvSnapshot
fn default() -> EnvSnapshot
Returns the “default value” for a type. Read more
impl Eq for EnvSnapshot
Source§impl PartialEq for EnvSnapshot
impl PartialEq for EnvSnapshot
impl StructuralPartialEq for EnvSnapshot
Auto Trait Implementations§
impl Forget for EnvSnapshot
impl Freeze for EnvSnapshot
impl Move for EnvSnapshot
impl RefUnwindSafe for EnvSnapshot
impl Send for EnvSnapshot
impl Sync for EnvSnapshot
impl Unpin for EnvSnapshot
impl UnsafeUnpin for EnvSnapshot
impl UnwindSafe for EnvSnapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more