Struct irx_config::config::Config
source · pub struct Config { /* private fields */ }
Expand description
Container for all parser sources which will (re)load data from a parsers in order in which they was added
to ConfigBuilder
. It will provide access to merged set of (re)loaded configuration parameters.
Implementations§
source§impl Config
impl Config
sourcepub fn reload(&mut self) -> Result<&mut Self>
pub fn reload(&mut self) -> Result<&mut Self>
Reload and re-merge all configuration data from parsers.
Errors
If any errors will occur during parsing/merging then error will be returned.
sourcepub fn get_by_keys<I, K, T>(&self, keys: I) -> Result<Option<T>>
pub fn get_by_keys<I, K, T>(&self, keys: I) -> Result<Option<T>>
sourcepub fn get_by_key_path<T, P>(&self, path: P) -> Result<Option<T>>
pub fn get_by_key_path<T, P>(&self, path: P) -> Result<Option<T>>
Returns configuration data value to corresponding key path with keys delimiter. Default delimiter is
DEFAULT_KEYS_SEPARATOR
.
Example
use serde::Deserialize;
#[derive(Deserialize)]
struct Person {
first_name: String,
last_name: String,
age: u8,
}
let person: Option<Person> = conf.get_by_key_path("contact:info")?;
Errors
If keys path or keys delimiter is empty, the corresponding error will be returned.
sourcepub fn get_by_key_path_with_delim<T, P, D>(
&self,
path: P,
delim: D
) -> Result<Option<T>>
pub fn get_by_key_path_with_delim<T, P, D>( &self, path: P, delim: D ) -> Result<Option<T>>
sourcepub fn get<T: DeserializeOwned>(&self) -> Result<T>
pub fn get<T: DeserializeOwned>(&self) -> Result<T>
Trait Implementations§
source§impl Ord for Config
impl Ord for Config
source§impl PartialEq for Config
impl PartialEq for Config
source§impl PartialOrd for Config
impl PartialOrd for Config
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Config
Auto Trait Implementations§
impl !RefUnwindSafe for Config
impl !Send for Config
impl !Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.