pub enum ConfigDir {
Generic(PathBuf),
Specific {
path: PathBuf,
profile: String,
},
}Expand description
Represents a single config-related directory.
Unlike with [ConfigFile]s, the path validity is not checked on
instantiation. But given that the filesystem is completely external to the
application, the existence or validity of any given path cannot be assumed
anyway.
Variants§
Generic(PathBuf)
A directory that is not associated with an AppProfile.
Specific
A directory that is associated with an AppProfile of the given name.
Implementations§
Source§impl ConfigDir
impl ConfigDir
Source§impl ConfigDir
impl ConfigDir
Sourcepub fn is_generic(&self) -> bool
pub fn is_generic(&self) -> bool
Reports whether this ConfigDir is applicable regardless of the
active AppProfile.
Sourcepub fn is_specific(&self) -> bool
pub fn is_specific(&self) -> bool
Reports whether this ConfigDir is applicable only to a particular
AppProfile.
Sourcepub fn profile(&self) -> Option<&str>
pub fn profile(&self) -> Option<&str>
Returns a reference to the internally held profile name (if this variant is specific).
Sourcepub fn applies_to_active_profile(&self) -> bool
pub fn applies_to_active_profile(&self) -> bool
Reports whether this ConfigDir applies to
the active AppProfile.
Sourcepub fn applies_to(&self, profile: impl AsRef<AppProfile>) -> bool
pub fn applies_to(&self, profile: impl AsRef<AppProfile>) -> bool
Reports whether this ConfigDir applies to the given AppProfile.
A generic config file (without a profile name in its file name) applies to any profile by default. A specific config file (with a profile name in its file name) applies to the given profile if the profile name matches.
Sourcepub fn expand(&self, profile: Option<&str>) -> Vec<ConfigEntry>
pub fn expand(&self, profile: Option<&str>) -> Vec<ConfigEntry>
Expands this directory into a vector of nested ConfigEntrys.