BatteryProvider

Trait BatteryProvider 

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

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

Trait for platform-specific battery providers.

Required Methods§

Source

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

Create a new battery provider instance.

Source

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

Refresh battery information from the system.

Source

fn info(&self) -> &BatteryInfo

Get the current battery information.

Provided Methods§

Source

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

Check if battery monitoring is supported on this system.

Implementors§