pub struct Battery(/* private fields */)
where
SysFsDevice: BatteryDevice;
Expand description
Battery instant information representation.
Consequent calls of the same method will return the same value.
See the Manager::refresh method,
which can be used to update information hold in the current Battery
.
Almost all methods are returning values in the SI measurement units,
represented as a units from the uom crate.
If you are unfamiliar with uom
, check the units module documentation for a few examples
of how to get the values from them.
Implementations§
Source§impl Battery
impl Battery
Sourcepub fn state_of_charge(&self) -> Ratio
pub fn state_of_charge(&self) -> Ratio
Battery state of charge.
The State of Charge (or SOC) is an expression of the battery capacity as a percentage of maximum capacity.
In plain english: it is how much energy your battery has (expressed in percents). This is an exactly that value which operating systems and desktop managers are displaying in the taskbar near the clock.
Roughly it can be calculated as battery.energy() / battery.energy_full()
,
but you should always use Battery::state_of_charge
instead of the manual calculation, because many device drivers are providing
this value more precisely, and this method takes that into account.
See also:
Sourcepub fn energy_full(&self) -> Energy
pub fn energy_full(&self) -> Energy
Amount of energy in the battery when it’s considered full.
Sourcepub fn energy_full_design(&self) -> Energy
pub fn energy_full_design(&self) -> Energy
Amount of energy the battery is designed to hold when it’s considered full.
Sourcepub fn energy_rate(&self) -> Power
pub fn energy_rate(&self) -> Power
Amount of energy being drained from the battery.
Sourcepub fn voltage(&self) -> ElectricPotential
pub fn voltage(&self) -> ElectricPotential
Battery voltage.
Sourcepub fn state_of_health(&self) -> Ratio
pub fn state_of_health(&self) -> Ratio
Gets battery state of health.
The State of Health (or SOH) is an indication of the point which has been reached in the life cycle of the battery and a measure of its condition relative to a fresh battery.
In plain english: this is how much energy in percents your battery can hold when fully charged. New battery - 100 %, old and degraded battery - notably lower amount of percents. See also:
Sourcepub fn technology(&self) -> Technology
pub fn technology(&self) -> Technology
Battery technology.
See Technology enum for possible values.
Sourcepub fn temperature(&self) -> Option<ThermodynamicTemperature>
pub fn temperature(&self) -> Option<ThermodynamicTemperature>
Battery temperature.
Sourcepub fn cycle_count(&self) -> Option<u32>
pub fn cycle_count(&self) -> Option<u32>
Number of charge/discharge cycles.
Sourcepub fn serial_number(&self) -> Option<&str>
pub fn serial_number(&self) -> Option<&str>
Battery serial number.
Sourcepub fn time_to_full(&self) -> Option<Time>
pub fn time_to_full(&self) -> Option<Time>
Remaining time till full battery.
This is an instant value and may different vastly from call to call. Any aggregation should be made by caller.
If battery is not charging at the moment, this method will return None
.
Sourcepub fn time_to_empty(&self) -> Option<Time>
pub fn time_to_empty(&self) -> Option<Time>
Remaining time till empty battery.
This is an instant value and may different vastly from call to call. Any aggregation should be made by caller.
If battery is not discharging at the moment, this method will return None
.