pub struct Config { /* private fields */ }
Expand description
Main configuration struct that holds all providers and handles retrieving values.
Implementations§
Source§impl Config
impl Config
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
Create a new configuration builder.
Sourcepub fn get<T: DeserializeOwned>(
&self,
key: &str,
) -> Result<Option<T>, ConfigError>
pub fn get<T: DeserializeOwned>( &self, key: &str, ) -> Result<Option<T>, ConfigError>
Get a configuration value by key, checking all providers in the order they were added. Returns the first value found.
Sourcepub fn get_or_default<T: DeserializeOwned>(
&self,
key: &str,
default: T,
) -> Result<T, ConfigError>
pub fn get_or_default<T: DeserializeOwned>( &self, key: &str, default: T, ) -> Result<T, ConfigError>
Get a configuration value by key with a default fallback value.
Sourcepub fn default_file(file_path: &str) -> Result<Self, ConfigError>
pub fn default_file(file_path: &str) -> Result<Self, ConfigError>
Create a default configuration using the file-based provider.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
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