Struct miau::configuration::Configuration [−][src]
Owns configuration trees built from all sources.
Allows retrieving data stored in all trees, merging them, creating lenses and converting into strongly typed structs.
Configuration
should only be created by builder or sources. Most functions are public to server most bizzare needs.
To read values from Configuration
you need to pull ConfigurationRead
in scope.
Example
use miau::configuration::{Configuration, ConfigurationRead}; let configuration = Configuration::default(); // aka empty let word: Option<String> = configuration.get("word"); assert_eq!(None, word);
Implementations
impl Configuration
[src]
pub fn new_singular(info: ConfigurationInfo, root: ConfigurationTree) -> Self
[src]
Creates new Configuration
from one tree and its associated information.
pub fn new_empty() -> Self
[src]
Creates new empty Configuration
.
pub fn lens(&self) -> Lens<'_>
[src]
Creates Lens
from this Configuration
.
pub fn try_convert_into<T: DeserializeOwned>(
self
) -> Result<T, ConfigurationError>
[src]
self
) -> Result<T, ConfigurationError>
Deserializes Configuration
into strongly typed struct.
It is only required that struct to be deserialized to implements Deserialize
and contains no borrowed fields, for instance &str
.
Due to memory model of miau
it is impossible to deserialize into such fields.
pub fn merge_owned(self) -> Result<ConfigurationTree, ConfigurationError>
[src]
Merges trees contained in Configuration
into one tree by consuming them.
To merge cloned, invoke lens
function first.
pub fn infos(&self) -> impl Iterator<Item = &ConfigurationInfo>
[src]
Retrives information about configuration trees, in order used internally by Configuration
.
let configuration = Configuration::default(); // normally populated configuration should be used! for info in configuration.infos() { println!("{}", info); }
Trait Implementations
impl Clone for Configuration
[src]
fn clone(&self) -> Configuration
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn get(&'config self, keys: K) -> Option<T>
[src]
impl Debug for Configuration
[src]
impl Default for Configuration
[src]
impl<'de> Deserialize<'de> for Configuration
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'config> From<&'config Configuration> for Lens<'config>
[src]
fn from(config: &'config Configuration) -> Self
[src]
impl From<ConfigurationTree> for Configuration
[src]
fn from(node: ConfigurationTree) -> Self
[src]
impl From<HashMap<String, String, RandomState>> for Configuration
[src]
impl Provider for Configuration
[src]
fn collect(&self) -> Result<Configuration, ConfigurationError>
[src]
fn describe(&self) -> ConfigurationInfo
[src]
Auto Trait Implementations
impl RefUnwindSafe for Configuration
[src]
impl Send for Configuration
[src]
impl Sync for Configuration
[src]
impl Unpin for Configuration
[src]
impl UnwindSafe for Configuration
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,