Trait miau::configuration::ConfigurationRead [−][src]
Represents object from which configuration can be read.
Required methods
fn get_result(&'config self, keys: K) -> Result<Option<T>, ConfigurationError>
[src]
Retrieves value stored in ConfigurationTree
under given keys
.
If key transformation fails error is returned. Value is returned if found, None
otherwise.
Example
//you need to have ConfigurationRead in scope use miau::configuration::{Configuration, ConfigurationRead}; use miau::error::ConfigurationError; let configuration = Configuration::default(); // aka empty let word: Result<Option<String>, ConfigurationError> = configuration.get_result("word"); match word { Ok(maybe_word) => { assert_eq!(None, maybe_word); }, Err(e) => println!("Oh no! {}", e) };
Provided methods
fn get(&'config self, keys: K) -> Option<T>
[src]
Retrieves value stored in configuration under given keys
.
If no value is found or key transformation fails None
is returned.
get_result
provides more insight into root cause of error.
Example
//you need to have ConfigurationRead in scope use miau::configuration::{Configuration, ConfigurationRead}; let configuration = Configuration::default(); // aka empty let word: Option<String> = configuration.get("word"); assert_eq!(None, word);
Implementors
impl<'config, T, K> ConfigurationRead<'config, T, K> for ConfigurationTree where
T: TryFrom<&'config Value, Error = ConfigurationError>,
K: TryInto<CompoundKey, Error = ConfigurationError>,
[src]
T: TryFrom<&'config Value, Error = ConfigurationError>,
K: TryInto<CompoundKey, Error = ConfigurationError>,
fn get_result(&'config self, keys: K) -> Result<Option<T>, ConfigurationError>
[src]
impl<'config, T, K> ConfigurationRead<'config, T, K> for Configuration where
T: TryFrom<&'config Value, Error = ConfigurationError>,
K: TryInto<CompoundKey, Error = ConfigurationError>,
[src]
T: TryFrom<&'config Value, Error = ConfigurationError>,
K: TryInto<CompoundKey, Error = ConfigurationError>,
fn get_result(&'config self, keys: K) -> Result<Option<T>, ConfigurationError>
[src]
impl<'config, T, K> ConfigurationRead<'config, T, K> for Lens<'config> where
T: TryFrom<&'config Value, Error = ConfigurationError>,
K: TryInto<CompoundKey, Error = ConfigurationError>,
[src]
T: TryFrom<&'config Value, Error = ConfigurationError>,
K: TryInto<CompoundKey, Error = ConfigurationError>,