Struct dmc::battery::BatteryState
[−]
[src]
pub struct BatteryState { pub status: Knowledge<BatteryStatus>, pub estimated_time_remaining: Knowledge<Duration>, pub percentage_remaining: Knowledge<f32>, }
The battery's state and useful associated information - Get it for the
user's device with the associated query()
function.
It's all packed into a single struct because on most platforms, it's cheaper to query everything at once rather than "coming back" for individual pieces of information.
Fields
status: Knowledge<BatteryStatus>
estimated_time_remaining: Knowledge<Duration>
percentage_remaining: Knowledge<f32>
The value is between 0 and 1 (both inclusive).
Methods
impl BatteryState
[src]
fn query() -> Self
Query the user's device's battery's current state.
You should consider this operation as expensive, and the result is not implicitly cached - it's up to you to cache it by yourself if you want to.
Trait Implementations
impl Debug for BatteryState
[src]
impl Default for BatteryState
[src]
fn default() -> BatteryState
Returns the "default value" for a type. Read more
impl Copy for BatteryState
[src]
impl Clone for BatteryState
[src]
fn clone(&self) -> BatteryState
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for BatteryState
[src]
fn eq(&self, __arg_0: &BatteryState) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &BatteryState) -> bool
This method tests for !=
.