pub trait BatteryProvider {
// Required methods
fn new() -> Result<Self>
where Self: Sized;
fn refresh(&mut self) -> Result<()>;
fn info(&self) -> &BatteryInfo;
// Provided methods
fn is_supported() -> bool
where Self: Sized { ... }
fn is_available() -> bool
where Self: Sized { ... }
}Expand description
Trait for platform-specific battery providers.
Required Methods§
Sourcefn info(&self) -> &BatteryInfo
fn info(&self) -> &BatteryInfo
Get the current battery information.
Provided Methods§
Sourcefn is_supported() -> boolwhere
Self: Sized,
fn is_supported() -> boolwhere
Self: Sized,
Check if battery monitoring is supported on this system.
Sourcefn is_available() -> boolwhere
Self: Sized,
fn is_available() -> boolwhere
Self: Sized,
Check if a battery is available on this system.