Skip to main content

SystemPower

Trait SystemPower 

Source
pub trait SystemPower {
    // Required methods
    fn get_system_power_state<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = SystemPowerState> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn system_powerctl(&self, cmd: u32) -> Result<(), Status>;
    fn has_resources(&self) -> bool;
    fn exit(&self, status: i32);
}
Expand description

System power operations.

Required Methods§

Source

fn get_system_power_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SystemPowerState> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the current system power state.

Source

fn system_powerctl(&self, cmd: u32) -> Result<(), Status>

Executes a system power control command (e.g. reboot, shutdown).

Source

fn has_resources(&self) -> bool

Returns true if the necessary power resource is available.

Source

fn exit(&self, status: i32)

Exits the process.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: SystemPower + ?Sized> SystemPower for Rc<T>

Source§

fn get_system_power_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SystemPowerState> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn system_powerctl(&self, cmd: u32) -> Result<(), Status>

Source§

fn has_resources(&self) -> bool

Source§

fn exit(&self, status: i32)

Implementors§