pub struct Config { /* private fields */ }Implementations§
Source§impl Config
impl Config
pub fn builder() -> ConfigBuilder
Sourcepub fn sources(&self) -> &[ConfigSourceInfo]
pub fn sources(&self) -> &[ConfigSourceInfo]
Returns source provenance in build order.
Sourcepub fn file_sources(&self) -> impl Iterator<Item = &Path>
pub fn file_sources(&self) -> impl Iterator<Item = &Path>
Iterates only existing file sources used during build.
Sourcepub fn primary_file_source(&self) -> Option<&Path>
pub fn primary_file_source(&self) -> Option<&Path>
Returns the first existing file source used during build.
Sourcepub fn get<T>(&self) -> Option<T>where
T: DeserializeOwned + ConfigItem,
pub fn get<T>(&self) -> Option<T>where
T: DeserializeOwned + ConfigItem,
Sourcepub fn expect<T>(&self) -> Twhere
T: DeserializeOwned + ConfigItem,
pub fn expect<T>(&self) -> Twhere
T: DeserializeOwned + ConfigItem,
Retrieves a required configuration section, panicking if not found or invalid.
§Panics
Panics if the configuration section is missing or cannot be deserialized. Recommended for
critical configuration items that must be present for the application to function. For optional
items, use get or get_or_default instead.
Sourcepub fn get_or_default<T>(&self) -> T
pub fn get_or_default<T>(&self) -> T
Retrieves a configuration section, returning default if not found or invalid.
§Returns
The section or its default.
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 UnsafeUnpin 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