pub trait EnvSource {
// Required method
fn var(&self, key: &str) -> Option<String>;
// Provided method
fn var_any(&self, keys: &[&str]) -> Option<String> { ... }
}Expand description
A read-only view of environment variables.
Implemented by SystemEnv (the real process environment) in production
and by an in-memory map in tests, so env-parsing boundaries can be tested
without mutating the process-global environment.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: EnvSource + ?Sized> EnvSource for &T
&T is an EnvSource whenever T is, so callers can pass &SystemEnv
or &map_env to functions taking &impl EnvSource without ceremony.
impl<T: EnvSource + ?Sized> EnvSource for &T
&T is an EnvSource whenever T is, so callers can pass &SystemEnv
or &map_env to functions taking &impl EnvSource without ceremony.