pub struct Config {
pub sensors: SensorConfig,
pub smart: SmartConfig,
pub btrfs: BtrfsConfig,
pub lhm: LhmConfig,
pub overview: OverviewConfig,
pub notifications: NotificationsConfig,
pub hosts: Vec<HostConfig>,
}Expand description
Top-level configuration.
Fields§
§sensors: SensorConfigSensor naming and visibility.
smart: SmartConfigSMART result files.
btrfs: BtrfsConfigbtrfs scrub status files.
lhm: LhmConfigLibreHardwareMonitor’s web server, the source of temperatures, fans and CPU power on Windows.
overview: OverviewConfigThe multi-host overview.
notifications: NotificationsConfigDesktop notifications for new alerts (GUI).
hosts: Vec<HostConfig>Remote hosts monitored over SSH ([[hosts]] tables).
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 save_hosts(path: &Path, hosts: &[HostConfig]) -> Result<(), ConfigError>
pub fn save_hosts(path: &Path, hosts: &[HostConfig]) -> Result<(), ConfigError>
Replaces the [[hosts]] of the configuration file at path with
hosts, keeping everything else in the file (other settings,
comments, formatting) untouched. Creates the file if needed.
Used by the GUI’s host editor. The edited file is checked to load as a valid configuration before it replaces the old one.
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.