pub struct BatteryCapacity {
pub design_microwatt_hours: u64,
pub full_microwatt_hours: u64,
}Expand description
A battery’s design capacity beside the capacity it can hold today.
The pair is one metric rather than two, because the only interesting thing
either number does is stand next to the other: 48 Wh means nothing until you
know the cell shipped holding 52 Wh. Keeping them together also makes
BatteryCapacity::health the only way to obtain a wear percentage, so a
health figure can never disagree with the capacities it was derived from.
Micro-watt-hours because that is the unit Linux’s energy_full_design uses;
a collector holding amp-hours converts once, at the point it knows the cell
voltage, rather than leaving two possible units in the model.
Fields§
§design_microwatt_hours: u64What the cell held when it left the factory, in µWh.
full_microwatt_hours: u64What a full charge holds today, in µWh. This is the worn figure.
Implementations§
Source§impl BatteryCapacity
impl BatteryCapacity
Sourcepub fn health(self) -> Option<Percent>
pub fn health(self) -> Option<Percent>
Today’s full charge as a share of the design capacity: battery health.
None when the design capacity is zero, which is not 0% health but an
unusable pair of numbers (§4). Deliberately not clamped to 100: a cell
whose first full charge measures above its design capacity is a real and
common reading, and clamping it would hide a working battery behind a
suspiciously exact figure.
Trait Implementations§
Source§impl Clone for BatteryCapacity
impl Clone for BatteryCapacity
Source§fn clone(&self) -> BatteryCapacity
fn clone(&self) -> BatteryCapacity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more