pub struct Config {Show 15 fields
pub sensors: SensorConfig,
pub smart: SmartConfig,
pub btrfs: BtrfsConfig,
pub lhm: LhmConfig,
pub ups: UpsConfig,
pub overview: OverviewConfig,
pub tui: TuiConfig,
pub gpu: GpuConfig,
pub network: NetworkConfig,
pub alerts: AlertsConfig,
pub notifications: NotificationsConfig,
pub updates: UpdatesConfig,
pub watch: WatchConfig,
pub hosts: Vec<HostConfig>,
pub widgets: Vec<WidgetConfig>,
}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.
ups: UpsConfigNetwork UPS Tools’ upsd, the source of UPS readings.
overview: OverviewConfigThe multi-host overview.
tui: TuiConfigThe terminal UI.
gpu: GpuConfigGPU panels and overview cards.
network: NetworkConfigThe network panel.
alerts: AlertsConfigWhen a reading becomes an alert.
notifications: NotificationsConfigDesktop notifications for new alerts (GUI).
updates: UpdatesConfigLooking for new rigtop releases.
watch: WatchConfigAlerts sent by rigtop --watch.
hosts: Vec<HostConfig>Remote hosts monitored over SSH ([[hosts]] tables).
widgets: Vec<WidgetConfig>Extra panels beside the monitor ([[widgets]] 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.
From the Microsoft Store’s package, the package’s LocalState folder
(see crate::package).
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 alerts_for(&self, host: &HostConfig) -> Result<AlertsConfig, Error>
pub fn alerts_for(&self, host: &HostConfig) -> Result<AlertsConfig, Error>
The alert thresholds of host: [alerts] with the keys of the
host’s own alerts table in place of its own.
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 save_tui(path: &Path, tui: &TuiConfig) -> Result<(), ConfigError>
pub fn save_tui(path: &Path, tui: &TuiConfig) -> Result<(), ConfigError>
Replaces the sensor names and hidden sensors ([sensors]) of the
configuration file at path, keeping the rest of the file as it is,
like Config::save_hosts. Names stay an inline table if they were
one.
Used by the GUI’s sensor editor.
Writes [tui] (keys left at their defaults are removed), leaving
the rest of the file as it is.
pub fn save_sensors( path: &Path, sensors: &SensorConfig, ) -> Result<(), ConfigError>
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.