pub struct Config {
pub default_profile: Option<String>,
pub profiles: BTreeMap<String, Profile>,
pub write: Targets,
}Expand description
The contents of the configuration file.
Fields§
§default_profile: Option<String>The profile to use when none is given.
profiles: BTreeMap<String, Profile>The profiles by name.
write: TargetsThe devices that may and may never be changed.
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_path() -> Option<PathBuf>
pub fn default_path() -> Option<PathBuf>
The usual place of the configuration file, like
~/.config/fritz/config.toml on Linux and macOS, see
dirs. None if the home directory is unknown.
Sourcepub fn load(path: &Path) -> Result<Self, Error>
pub fn load(path: &Path) -> Result<Self, Error>
Reads the configuration, or returns an empty one if the file does not exist.
Sourcepub fn save(&self, path: &Path) -> Result<(), Error>
pub fn save(&self, path: &Path) -> Result<(), Error>
Writes the configuration, creating the directory if needed. Replaces the file at once, so a failed write leaves the old one intact.
Sourcepub fn writable_by_others(path: &Path) -> bool
pub fn writable_by_others(path: &Path) -> bool
Whether others than the owner may change the file, which matters
when it contains a password command. Always false on systems
without Unix permissions, and when the file cannot be read.
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
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Forget for Config
impl Freeze for Config
impl Move 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