Struct salak::SourceRegistry [−][src]
An implementation of Environment
for registering PropertySource
.
Implementations
impl SourceRegistry
[src]
pub fn new() -> Self
[src]
Create an empty registry.
pub fn with_args(self, mode: SysArgsMode) -> Self
[src]
This is supported on crate features
enable_clap
or enable_pico
only.Add default command line arguments parser.
pub fn with_sys_env(self) -> Self
[src]
Add system environment.
pub fn with_toml(self) -> Result<Self, PropertyError>
[src]
This is supported on crate feature
enable_toml
only.Add toml support.
pub fn with_yaml(self) -> Result<Self, PropertyError>
[src]
This is supported on crate feature
enable_yaml
only.Add yaml support.
pub fn register_source(&mut self, source: Box<dyn PropertySource>)
[src]
Add yaml support. Register source.
pub fn register_sources(&mut self, sources: Vec<Box<dyn PropertySource>>)
[src]
Register multiple sources.
Trait Implementations
impl Default for SourceRegistry
[src]
impl Environment for SourceRegistry
[src]
fn contains(&self, name: &str) -> bool
[src]
fn require<T: FromEnvironment>(&self, name: &str) -> Result<T, PropertyError>
[src]
fn resolve_placeholder(
&self,
v: String
) -> Result<Option<Property>, PropertyError>
[src]
&self,
v: String
) -> Result<Option<Property>, PropertyError>
fn find_keys(&self, prefix: &str) -> Vec<String>
[src]
fn reload(&mut self) -> Result<(), PropertyError>
[src]
fn require_or<T: FromEnvironment>(
&self,
key: &str,
default: T
) -> Result<T, PropertyError>
[src]
&self,
key: &str,
default: T
) -> Result<T, PropertyError>
fn get<T: FromEnvironment>(&self, key: &str) -> Option<T>
[src]
fn get_or<T: FromEnvironment>(&self, key: &str, default: T) -> T
[src]
fn load_config<T: DefaultSourceFromEnvironment>(
&self
) -> Result<T, PropertyError>
[src]
&self
) -> Result<T, PropertyError>
Auto Trait Implementations
impl !RefUnwindSafe for SourceRegistry
impl Send for SourceRegistry
impl Sync for SourceRegistry
impl Unpin for SourceRegistry
impl !UnwindSafe for SourceRegistry
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> 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,