pub trait ConfigurationProvider {
// Required methods
fn get(&self, key: &str) -> Option<Value>;
fn child_keys(
&self,
earlier_keys: &mut Vec<String>,
parent_path: Option<&str>,
);
// Provided methods
fn name(&self) -> &str { ... }
fn reload_token(&self) -> Box<dyn ChangeToken> { ... }
fn load(&mut self) -> LoadResult { ... }
}Expand description
Defines the behavior of an object that provides configuration key/values for an application.
Required Methods§
Sourcefn get(&self, key: &str) -> Option<Value>
fn get(&self, key: &str) -> Option<Value>
Attempts to get a configuration value with the specified key.
§Arguments
key- The key of the value to retrieve
Sourcefn child_keys(&self, earlier_keys: &mut Vec<String>, parent_path: Option<&str>)
fn child_keys(&self, earlier_keys: &mut Vec<String>, parent_path: Option<&str>)
Gets the immediate descendent configuration keys for a given parent path based
on this ConfigurationProvider and the set of keys returned by all of the
preceding ConfigurationProvider.
§Arguments
earlier_keys- The sequence of keys returned by preceding provider for the same parent pathparent_path- The optional parent path to evaluate
Provided Methods§
Sourcefn reload_token(&self) -> Box<dyn ChangeToken>
fn reload_token(&self) -> Box<dyn ChangeToken>
Returns a ChangeToken if this provider supports change tracking.
Sourcefn load(&mut self) -> LoadResult
fn load(&mut self) -> LoadResult
Loads the configuration values from the implemented source.
Implementors§
impl ConfigurationProvider for ChainedConfigurationProvider
Available on crate feature
chained only.impl ConfigurationProvider for CommandLineConfigurationProvider
Available on crate feature
cmd only.impl ConfigurationProvider for EnvironmentVariablesConfigurationProvider
Available on crate feature
env only.impl ConfigurationProvider for IniConfigurationProvider
Available on crate feature
ini only.impl ConfigurationProvider for JsonConfigurationProvider
Available on crate feature
json only.impl ConfigurationProvider for MemoryConfigurationProvider
Available on crate feature
mem only.impl ConfigurationProvider for XmlConfigurationProvider
Available on crate feature
xml only.