pub struct BatteryStats {
pub percent: Option<f32>,
pub status: String,
pub power_w: Option<f32>,
pub time_left_secs: Option<u64>,
pub health_percent: Option<f32>,
}Expand description
Charge and power of the system’s batteries (summed when there are
several), from /sys/class/power_supply on Linux.
Fields§
§percent: Option<f32>Charge in percent.
status: StringKernel status: Charging, Discharging, Full, Not charging…
power_w: Option<f32>Charge or discharge power (not signed; see status).
time_left_secs: Option<u64>Until empty while discharging, until full while charging, at the recent (smoothed) rate.
health_percent: Option<f32>Full charge as a share of the design capacity (wear), in percent.
Implementations§
Source§impl BatteryStats
impl BatteryStats
Sourcepub fn summary(&self) -> String
pub fn summary(&self) -> String
Short form for status lines: 72% -12W 3h10m while discharging
(with the time left when known), +20W while charging.
Sourcepub fn health_note(&self) -> Option<String>
pub fn health_note(&self) -> Option<String>
The health worth showing next to the charge: below 80% of the design capacity, where batteries are usually considered worn.
Trait Implementations§
Source§impl Clone for BatteryStats
impl Clone for BatteryStats
Source§impl Debug for BatteryStats
impl Debug for BatteryStats
Source§impl Default for BatteryStats
impl Default for BatteryStats
Source§impl<'de> Deserialize<'de> for BatteryStatswhere
BatteryStats: Default,
impl<'de> Deserialize<'de> for BatteryStatswhere
BatteryStats: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for BatteryStats
impl PartialEq for BatteryStats
Source§impl Serialize for BatteryStats
impl Serialize for BatteryStats
impl StructuralPartialEq for BatteryStats
Auto Trait Implementations§
impl Freeze for BatteryStats
impl RefUnwindSafe for BatteryStats
impl Send for BatteryStats
impl Sync for BatteryStats
impl Unpin for BatteryStats
impl UnsafeUnpin for BatteryStats
impl UnwindSafe for BatteryStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more