pub struct Config {
pub defaults: Defaults,
pub accounts: HashMap<String, AccountConfig>,
}Expand description
Top-level configuration parsed from a TOML file.
Fields§
§defaults: Defaults§accounts: HashMap<String, AccountConfig>Implementations§
Source§impl Config
impl Config
Sourcepub fn from_toml(toml_str: &str) -> Result<Self>
pub fn from_toml(toml_str: &str) -> Result<Self>
Parse toml_str and validate the result.
Validation rejects any pair of accounts whose root directories nest inside one another. Duplicate account labels are rejected by the TOML parser itself.
Sourcepub fn resolve(
&self,
account: &str,
source: Option<&str>,
env: &HashMap<String, String>,
flags: &FlagOverrides,
) -> Result<EffectiveSettings>
pub fn resolve( &self, account: &str, source: Option<&str>, env: &HashMap<String, String>, flags: &FlagOverrides, ) -> Result<EffectiveSettings>
Compute effective settings for account, optionally scoped to source.
The caller supplies the full environment map and any CLI flag overrides. Precedence per field: flag > per-account env > global env > per-source file > per-account file > global file defaults > compiled default.
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 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