pub enum ConfigSource {
Defaults,
File(PathBuf),
Env {
prefix: Option<String>,
},
}Expand description
Specifies where configuration values should be loaded from.
Sources are applied in order; later sources overwrite earlier values.
Variants§
Defaults
Apply compile-time defaults declared with #[param(default = ...)].
File(PathBuf)
Read a TOML file at the given path.
Missing files are silently skipped (not an error) so that optional config files work without extra boilerplate.
Env
Read environment variables.
Each field is looked up under {PREFIX}_{FIELD_UPPER} (e.g. prefix
"APP", field host → APP_HOST). An explicit #[param(env = "X")]
overrides the generated name entirely.
prefix is uppercased automatically; None means no prefix.
Trait Implementations§
Source§impl Clone for ConfigSource
impl Clone for ConfigSource
Source§fn clone(&self) -> ConfigSource
fn clone(&self) -> ConfigSource
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 moreAuto Trait Implementations§
impl Freeze for ConfigSource
impl RefUnwindSafe for ConfigSource
impl Send for ConfigSource
impl Sync for ConfigSource
impl Unpin for ConfigSource
impl UnsafeUnpin for ConfigSource
impl UnwindSafe for ConfigSource
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