use std::fmt::Debug; use super::SettingError; use super::MinMax; pub trait OnSet { fn on_set(&mut self) -> Result<(), SettingError>; } pub trait OnResume { fn on_resume(&self) -> Result<(), SettingError>; } pub trait SettingsRange { fn max() -> Self; fn min() -> Self; } pub trait TGpu: OnResume + OnSet + Debug + Send { fn limits(&self) -> crate::api::GpuLimits; fn json(&self) -> crate::persist::GpuJson; fn ppt(&mut self, fast: Option, slow: Option); fn get_ppt(&self) -> (Option, Option); fn clock_limits(&mut self, limits: Option>); fn get_clock_limits(&self) -> Option<&MinMax>; fn slow_memory(&mut self) -> &mut bool; } pub trait TCpus: OnResume + OnSet + Debug + Send { fn limits(&self) -> crate::api::CpusLimits; fn json(&self) -> Vec; fn cpus(&mut self) -> Vec<&mut dyn TCpu>; fn len(&self) -> usize; } pub trait TCpu: Debug + Send { fn online(&mut self) -> &mut bool; fn governor(&mut self, governor: String); fn get_governor(&self) -> &'_ str; fn clock_limits(&mut self, limits: Option>); fn get_clock_limits(&self) -> Option<&MinMax>; } pub trait TGeneral: OnResume + OnSet + Debug + Send { fn limits(&self) -> crate::api::GeneralLimits; fn get_persistent(&self) -> bool; fn persistent(&mut self) -> &'_ mut bool; fn get_path(&self) -> &'_ std::path::Path; fn path(&mut self, path: std::path::PathBuf); fn get_name(&self) -> &'_ str; fn name(&mut self, name: String); fn provider(&self) -> crate::persist::DriverJson; } pub trait TBattery: OnResume + OnSet + Debug + Send { fn limits(&self) -> crate::api::BatteryLimits; fn json(&self) -> crate::persist::BatteryJson; fn charge_rate(&mut self, rate: Option); fn get_charge_rate(&self) -> Option; }