pub struct ConfigStack { /* private fields */ }Expand description
A minimal, explicit config layering plan.
Precedence (low → high): Defaults → FilePath → EnvPrefix.
Implementations§
Source§impl ConfigStack
impl ConfigStack
Sourcepub fn with_defaults(self) -> Self
pub fn with_defaults(self) -> Self
Enable defaults as the lowest-precedence source.
Sourcepub fn with_file_path(self, path: impl Into<String>) -> Self
pub fn with_file_path(self, path: impl Into<String>) -> Self
Add a file path source.
Sourcepub fn with_env_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_env_prefix(self, prefix: impl Into<String>) -> Self
Add an environment variable prefix source.
Sourcepub fn sources(&self) -> Vec<ConfigSource>
pub fn sources(&self) -> Vec<ConfigSource>
Return sources in application order (low → high precedence).
Sourcepub fn load_kv_map(&self, defaults: ConfigMap) -> Result<ConfigMap>
pub fn load_kv_map(&self, defaults: ConfigMap) -> Result<ConfigMap>
Load a merged key/value configuration map.
Precedence (low → high): Defaults → FilePath → EnvPrefix.
Notes:
- Defaults are provided by the caller (so applications own their schema).
- File format is simple
KEY=VALUElines; comments start with#.
§Errors
Returns an error when reading or parsing the configured file fails, or when environment loading fails.
Trait Implementations§
Source§impl Clone for ConfigStack
impl Clone for ConfigStack
Source§fn clone(&self) -> ConfigStack
fn clone(&self) -> ConfigStack
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfigStack
impl Debug for ConfigStack
Source§impl Default for ConfigStack
impl Default for ConfigStack
Source§fn default() -> ConfigStack
fn default() -> ConfigStack
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigStack
impl RefUnwindSafe for ConfigStack
impl Send for ConfigStack
impl Sync for ConfigStack
impl Unpin for ConfigStack
impl UnwindSafe for ConfigStack
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