[−][src]Struct viperus::Viperus
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]
&mut self,
matches: ArgMatches<'v>
) -> Result<(), Box<dyn Error>>
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]
&mut self,
name: &str,
format: Format
) -> Result<(), Box<dyn Error>>
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]
&mut self,
adt: &mut dyn ConfigAdapter
) -> Result<(), Box<dyn Error>>
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]
ViperusValue: From<T>,
&'c ViperusValue: Into<T>,
ViperusValue: Into<T>,
T: FromStr,
T: Clone,
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]
ViperusValue: From<T>,
ViperusValue: Into<T>,
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]
ViperusValue: From<T>,
ViperusValue: Into<T>,
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
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]
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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>,