pub struct Config {
pub sensors: SensorConfig,
pub smart: SmartConfig,
pub btrfs: BtrfsConfig,
}Expand description
Top-level configuration.
Fields§
§sensors: SensorConfigSensor naming and visibility.
smart: SmartConfigSMART result files.
btrfs: BtrfsConfigbtrfs scrub status files.
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_path() -> Option<PathBuf>
pub fn default_path() -> Option<PathBuf>
Default path of the configuration file, if the platform has a config directory.
Sourcepub fn load(path: &Path) -> Result<Self, ConfigError>
pub fn load(path: &Path) -> Result<Self, ConfigError>
Loads the configuration from path. A missing file yields the defaults.
Sourcepub fn load_default() -> Result<Self, ConfigError>
pub fn load_default() -> Result<Self, ConfigError>
Loads from Config::default_path, or returns the defaults when the
platform has no config directory.
Sourcepub fn save(&self, path: &Path) -> Result<(), ConfigError>
pub fn save(&self, path: &Path) -> Result<(), ConfigError>
Writes the configuration to path, creating parent directories.
The file is written to a temporary sibling and renamed into place, so a crash never leaves a truncated config behind.
Sourcepub fn fan_label<'a>(&'a self, fan: &'a Fan) -> &'a str
pub fn fan_label<'a>(&'a self, fan: &'a Fan) -> &'a str
Display name of a fan: the user-defined label, or the driver/generic label.
Sourcepub fn temperature_label<'a>(&'a self, temperature: &'a Temperature) -> &'a str
pub fn temperature_label<'a>(&'a self, temperature: &'a Temperature) -> &'a str
Display name of a temperature channel.
Sourcepub fn label_for(&self, key: &str) -> Option<&str>
pub fn label_for(&self, key: &str) -> Option<&str>
User-defined label for a channel key, if any.
Sourcepub fn set_label(&mut self, key: &str, name: &str)
pub fn set_label(&mut self, key: &str, name: &str)
Sets (or, with an empty name, removes) the label of a channel.
Whether the user chose to hide a channel.