1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-28 01:17:45 +00:00

config: better serialization in config structs

This commit is contained in:
NotAShelf 2025-05-16 01:05:37 +03:00
parent 8252f0d74e
commit 09427ccc9a
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

View file

@ -119,7 +119,7 @@ impl std::fmt::Display for ConfigError {
impl std::error::Error for ConfigError {} impl std::error::Error for ConfigError {}
// Intermediate structs for TOML parsing // Intermediate structs for TOML parsing
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ProfileConfigToml { pub struct ProfileConfigToml {
pub governor: Option<String>, pub governor: Option<String>,
pub turbo: Option<String>, // "always", "auto", "never" pub turbo: Option<String>, // "always", "auto", "never"
@ -132,7 +132,7 @@ pub struct ProfileConfigToml {
pub battery_charge_thresholds: Option<BatteryChargeThresholds>, pub battery_charge_thresholds: Option<BatteryChargeThresholds>,
} }
#[derive(Deserialize, Debug, Clone, Default)] #[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct AppConfigToml { pub struct AppConfigToml {
#[serde(default)] #[serde(default)]
pub charger: ProfileConfigToml, pub charger: ProfileConfigToml,
@ -286,7 +286,7 @@ const fn default_stats_file_path() -> Option<String> {
None None
} }
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Serialize, Debug, Clone)]
pub struct DaemonConfigToml { pub struct DaemonConfigToml {
#[serde(default = "default_poll_interval_sec")] #[serde(default = "default_poll_interval_sec")]
pub poll_interval_sec: u64, pub poll_interval_sec: u64,