pub trait Environment: Send + Sync {
// Required methods
fn get_var(&self, name: &str) -> Option<String>;
fn set_var(&self, name: &str, value: &str);
fn remove_var(&self, name: &str);
}Expand description
Platform-agnostic environment variable access.
Implementations provide read/write access to environment-style key-value configuration. The native implementation maps directly to OS environment variables; alternative implementations can use in-memory maps for testing or WASM compatibility.
Required Methods§
Sourcefn get_var(&self, name: &str) -> Option<String>
fn get_var(&self, name: &str) -> Option<String>
Get the value of an environment variable, or None if it is not set.
Sourcefn remove_var(&self, name: &str)
fn remove_var(&self, name: &str)
Remove (unset) an environment variable.
Implementors§
impl Environment for NativeEnvironment
Available on crate feature
native only.