mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
ridiculous refactor to allow enums to be dbus strings for better TS generation
This commit is contained in:
@@ -13,6 +13,7 @@ dbus = ["zbus"]
|
||||
udev.workspace = true
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
typeshare.workspace = true
|
||||
|
||||
zbus = { workspace = true, optional = true }
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
use udev::Device;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::Type;
|
||||
@@ -26,6 +27,7 @@ pub(crate) fn temp_str(fan: char, index: usize) -> String {
|
||||
buf
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Deserialize, Serialize, Default, Debug, Clone)]
|
||||
pub struct CurveData {
|
||||
@@ -195,6 +197,7 @@ impl CurveData {
|
||||
}
|
||||
|
||||
/// A `FanCurveSet` contains both CPU and GPU fan curve data
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||
pub struct FanCurveSet {
|
||||
|
||||
@@ -9,6 +9,7 @@ use std::path::Path;
|
||||
use error::ProfileError;
|
||||
use fan_curve_set::{CurveData, FanCurveSet};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
use udev::Device;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::Type;
|
||||
@@ -35,7 +36,8 @@ pub fn find_fan_curve_node() -> Result<Option<Device>, ProfileError> {
|
||||
Err(ProfileError::NotSupported)
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
|
||||
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
|
||||
pub enum Profile {
|
||||
Balanced,
|
||||
@@ -127,7 +129,8 @@ impl Display for Profile {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
|
||||
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum FanCurvePU {
|
||||
CPU,
|
||||
@@ -162,6 +165,7 @@ impl Default for FanCurvePU {
|
||||
}
|
||||
|
||||
/// Main purpose of `FanCurves` is to enable restoring state on system boot
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Deserialize, Serialize, Debug, Default)]
|
||||
pub struct FanCurveProfiles {
|
||||
|
||||
Reference in New Issue
Block a user