[][src]Struct viperus::Viperus

pub struct Viperus<'a> { /* fields omitted */ }

A unified config Facade

Viperous manage config source from files, env and command line parameters in a unified manner

Methods

impl<'v> Viperus<'v>[src]

pub fn new() -> Self[src]

pub fn load_clap(
    &mut self,
    matches: ArgMatches<'v>
) -> Result<(), Box<dyn Error>>
[src]

load_clap brings in the clap magic

pub fn reload(&mut self) -> Result<(), Box<dyn Error>>[src]

reload all config file preserving the order

pub fn loaded_file_names(&self) -> Vec<String>[src]

pub fn load_file(
    &mut self,
    name: &str,
    format: Format
) -> Result<(), Box<dyn Error>>
[src]

load_file load a config file using one of the preconfigured addapters then applay the adatpter using load_adapter method

pub fn load_adapter(
    &mut self,
    adt: &mut dyn ConfigAdapter
) -> Result<(), Box<dyn Error>>
[src]

load_adapter ask the adapter to parse her data and merges result map in the internal configartion map

pub fn get<'a, 'b, 'c, T>(&'a self, key: &'b str) -> Option<T> where
    ViperusValue: From<T>,
    &'c ViperusValue: Into<T>,
    ViperusValue: Into<T>,
    T: FromStr,
    T: Clone
[src]

get a configuration value of type T in this order

  • overrided key
  • clap parameters
  • config adapter sourced values

pub fn add<'a, T>(&'a mut self, key: &'a str, value: T) -> Option<T> where
    ViperusValue: From<T>,
    ViperusValue: Into<T>, 
[src]

add an override value to the cofiguration

key is structured in components separated by a "."

pub fn bond_clap(&mut self, src: &str, dst: &str) -> Option<String>[src]

pub fn add_default<'a, T>(&'a mut self, key: &'a str, value: T) -> Option<T> where
    ViperusValue: From<T>,
    ViperusValue: Into<T>, 
[src]

add an default value to the configuration

key is structured in components separated by a "."

pub fn cache(&mut self, enable: bool)[src]

cache the query results for small configs speedup is x4

Trait Implementations

impl<'a> Debug for Viperus<'a>[src]

impl<'v> Default for Viperus<'v>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Viperus<'a>

impl<'a> Send for Viperus<'a>

impl<'a> !Sync for Viperus<'a>

impl<'a> Unpin for Viperus<'a>

impl<'a> UnwindSafe for Viperus<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.