sysfs_class/runtime_pm.rs
1use std::io;
2
3/// Control whether a device uses, or does not use, runtime power management.
4#[derive(Copy, Clone, Debug, PartialEq)]
5pub enum RuntimePowerManagement {
6 On,
7 Off,
8}
9
10impl From<RuntimePowerManagement> for &'static str {
11 fn from(pm: RuntimePowerManagement) -> &'static str {
12 match pm {
13 RuntimePowerManagement::On => "auto",
14 RuntimePowerManagement::Off => "on",
15 }
16 }
17}
18
19pub trait RuntimePM {
20 fn set_runtime_pm(&self, state: RuntimePowerManagement) -> io::Result<()>;
21}