PowerProvider

Trait PowerProvider 

Source
pub trait PowerProvider {
    // Required methods
    fn new() -> Result<Self>
       where Self: Sized;
    fn refresh(&mut self) -> Result<()>;
    fn info(&self) -> &PowerInfo;

    // Provided method
    fn is_supported() -> bool
       where Self: Sized { ... }
}
Expand description

Trait for platform-specific power providers.

Required Methods§

Source

fn new() -> Result<Self>
where Self: Sized,

Create a new power provider instance.

Source

fn refresh(&mut self) -> Result<()>

Refresh power information from the system.

Source

fn info(&self) -> &PowerInfo

Get the current power information.

Provided Methods§

Source

fn is_supported() -> bool
where Self: Sized,

Check if power monitoring is supported on this system.

Returns false if the required hardware/permissions are not available.

Implementors§