Skip to main content

EnvSource

Trait EnvSource 

Source
pub trait EnvSource {
    // Required methods
    fn get(&self, name: &str) -> Option<String>;
    fn names(&self) -> Vec<String>;
}
Expand description

A set of environment variables that can be read and enumerated.

Enumeration is required because catching a misspelled name means noticing a variable that is present but undeclared — which is impossible if you can only look up names you already know.

Required Methods§

Source

fn get(&self, name: &str) -> Option<String>

The raw value of name, if present.

Source

fn names(&self) -> Vec<String>

Every variable name present in this source.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl EnvSource for BTreeMap<String, String>

Source§

fn get(&self, name: &str) -> Option<String>

Source§

fn names(&self) -> Vec<String>

Source§

impl EnvSource for HashMap<String, String>

Source§

fn get(&self, name: &str) -> Option<String>

Source§

fn names(&self) -> Vec<String>

Source§

impl<T: EnvSource + ?Sized> EnvSource for &T

Source§

fn get(&self, name: &str) -> Option<String>

Source§

fn names(&self) -> Vec<String>

Implementors§