pub struct Config {
pub core: CoreConfig,
pub paths: PathsConfig,
pub env: ConfigEnv,
pub(crate) config_root: Option<PathBuf>,
}Fields§
§core: CoreConfig§paths: PathsConfig§env: ConfigEnv§config_root: Option<PathBuf>Implementations§
Source§impl Config
impl Config
pub fn sections(&self) -> Vec<ConfigSection>
pub fn effective_value( &self, key: &str, ) -> Result<(String, ConfigSource), ConfigError>
pub fn effective_optional_value( &self, key: &str, ) -> Result<Option<(String, ConfigSource)>, ConfigError>
pub fn effective_sections(&self) -> Result<Vec<ConfigSection>>
pub fn get_value(&self, key: &str) -> Result<Option<String>, ConfigError>
fn lookup_effective( &self, key: &str, ) -> Result<Option<(String, ConfigSource)>, ConfigError>
Source§impl Config
impl Config
pub fn set_value(&mut self, key: &str, value: &str) -> Result<(), ConfigError>
pub fn unset_value(&mut self, key: &str) -> Result<(), ConfigError>
Source§impl Config
impl Config
pub fn load(path: &Path) -> Result<Self>
pub fn load_at(root: &Path) -> Result<Self>
pub fn save(&self, path: &Path) -> Result<()>
Sourcepub fn save_default(&self) -> Result<()>
pub fn save_default(&self) -> Result<()>
Save the config back to the root it was loaded from.
For Config::load_current, this is the environment/default-selected
config storage root. For Config::load_at, this remains the explicit
root passed by the caller, so ambient WINBREW_* overrides stay ignored.
This storage root can differ from the effective runtime paths.root.
pub fn load_current() -> Result<Self>
Sourcepub fn resolved_paths(&self) -> ResolvedPaths
pub fn resolved_paths(&self) -> ResolvedPaths
Build runtime paths from the effective config values.
This uses effective paths.root, including environment overrides. That
is intentionally separate from the config storage root used by
Config::save_default.
fn with_env(self, env: ConfigEnv) -> Self
fn with_config_root(self, root: &Path) -> Self
fn config_storage_root(&self) -> PathBuf
fn runtime_root(&self) -> PathBuf
fn resolve_root_from_env(env: &ConfigEnv) -> PathBuf
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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