pub struct Environment { /* private fields */ }
Implementations§
Source§impl Environment
impl Environment
pub fn new() -> Self
👎Deprecated since 0.12.0: please use ‘Environment::default’ instead
pub fn with_prefix(s: &str) -> Self
pub fn prefix(self, s: &str) -> Self
pub fn prefix_separator(self, s: &str) -> Self
pub fn separator(self, s: &str) -> Self
Sourcepub fn list_separator(self, s: &str) -> Self
pub fn list_separator(self, s: &str) -> Self
When set and try_parsing is true, then all environment variables will be parsed as Vec<String>
instead of String
.
See [with_list_parse_key
] when you want to use Vec<String>
in combination with String
.
Sourcepub fn with_list_parse_key(self, key: &str) -> Self
pub fn with_list_parse_key(self, key: &str) -> Self
Add a key which should be parsed as a list when collecting Value
s from the environment.
Once list_separator is set, the type for string is Vec<String>
.
To switch the default type back to type Strings you need to provide the keys which should be Vec<String>
using this function.
pub fn ignore_empty(self, ignore: bool) -> Self
Sourcepub fn try_parsing(self, try_parsing: bool) -> Self
pub fn try_parsing(self, try_parsing: bool) -> Self
Note: enabling try_parsing
can reduce performance it will try and parse
each environment variable 3 times (bool, i64, f64)
pub fn keep_prefix(self, keep: bool) -> Self
pub fn source(self, source: Option<Map<String, String>>) -> Self
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a copy of the value. Read more
1.0.0 · 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 Environment
impl Debug for Environment
Source§impl Default for Environment
impl Default for Environment
Source§fn default() -> Environment
fn default() -> Environment
Returns the “default value” for a type. Read more
Source§impl Source for Environment
impl Source for Environment
fn clone_into_box(&self) -> Box<dyn Source + Send + Sync>
Source§fn collect(&self) -> Result<Map<String, Value>, ConfigError>
fn collect(&self) -> Result<Map<String, Value>, ConfigError>
Collect all configuration properties available from this source and return
a Map.
Source§fn collect_to(&self, cache: &mut Value) -> Result<(), ConfigError>
fn collect_to(&self, cache: &mut Value) -> Result<(), ConfigError>
Collects all configuration properties to a provided cache.
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
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