pub struct ConfigResolver {
pub cli_flags: HashMap<String, Option<String>>,
pub config_file: Option<HashMap<String, String>>,
pub defaults: HashMap<&'static str, &'static str>,
/* private fields */
}Expand description
Resolved configuration following 4-tier precedence:
- CLI flags — highest priority
- Environment variables
- Config file (YAML, dot-flattened keys)
- Built-in defaults — lowest priority
Fields§
§cli_flags: HashMap<String, Option<String>>CLI flags map (flag name → value or None if not provided).
config_file: Option<HashMap<String, String>>Flattened key → value map loaded from the config file.
None if the file was not found or could not be parsed.
defaults: HashMap<&'static str, &'static str>Built-in default values.
Implementations§
Source§impl ConfigResolver
impl ConfigResolver
Sourcepub fn new(
cli_flags: Option<HashMap<String, Option<String>>>,
config_path: Option<PathBuf>,
) -> Self
pub fn new( cli_flags: Option<HashMap<String, Option<String>>>, config_path: Option<PathBuf>, ) -> Self
Create a new ConfigResolver.
§Arguments
cli_flags— CLI flag overrides (e.g.--extensions-dir → /path)config_path— Optional explicit path toapcore.yaml
Sourcepub fn resolve(
&self,
key: &str,
cli_flag: Option<&str>,
env_var: Option<&str>,
) -> Option<String>
pub fn resolve( &self, key: &str, cli_flag: Option<&str>, env_var: Option<&str>, ) -> Option<String>
Resolve a configuration value using 4-tier precedence.
§Arguments
key— dot-separated config key (e.g."extensions.root")cli_flag— optional CLI flag name to check in_cli_flagsenv_var— optional environment variable name
Returns None when the key is not present in any tier.
Auto Trait Implementations§
impl Freeze for ConfigResolver
impl RefUnwindSafe for ConfigResolver
impl Send for ConfigResolver
impl Sync for ConfigResolver
impl Unpin for ConfigResolver
impl UnsafeUnpin for ConfigResolver
impl UnwindSafe for ConfigResolver
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