pub struct BatteryInfo {Show 13 fields
pub percentage: f32,
pub status: BatteryStatus,
pub time_remaining_minutes: Option<u32>,
pub health_percent: Option<f32>,
pub design_capacity_wh: Option<f32>,
pub current_capacity_wh: Option<f32>,
pub cycle_count: Option<u32>,
pub temperature: Option<f32>,
pub voltage: Option<f32>,
pub current: Option<f32>,
pub manufacturer: Option<String>,
pub model: Option<String>,
pub serial_number: Option<String>,
}
Expand description
Battery information
Fields§
§percentage: f32
Current battery percentage (0-100)
status: BatteryStatus
Battery status
time_remaining_minutes: Option<u32>
Time remaining in minutes (if available)
health_percent: Option<f32>
Battery health percentage (0-100)
design_capacity_wh: Option<f32>
Design capacity in Wh
current_capacity_wh: Option<f32>
Current capacity in Wh
cycle_count: Option<u32>
Cycle count
temperature: Option<f32>
Battery temperature in Celsius
voltage: Option<f32>
Voltage in Volts
current: Option<f32>
Current in Amperes
manufacturer: Option<String>
Battery manufacturer
model: Option<String>
Battery model
serial_number: Option<String>
Battery serial number
Implementations§
Source§impl BatteryInfo
impl BatteryInfo
Sourcepub fn percentage(&self) -> f32
pub fn percentage(&self) -> f32
Get battery percentage
Sourcepub fn status(&self) -> &BatteryStatus
pub fn status(&self) -> &BatteryStatus
Get battery status
Sourcepub fn is_charging(&self) -> bool
pub fn is_charging(&self) -> bool
Check if battery is charging
Sourcepub fn is_discharging(&self) -> bool
pub fn is_discharging(&self) -> bool
Check if battery is discharging
Sourcepub fn time_remaining_hours(&self) -> Option<f32>
pub fn time_remaining_hours(&self) -> Option<f32>
Get time remaining in hours
Sourcepub fn health_percent(&self) -> Option<f32>
pub fn health_percent(&self) -> Option<f32>
Get battery health percentage
Sourcepub fn wear_percent(&self) -> Option<f32>
pub fn wear_percent(&self) -> Option<f32>
Calculate battery wear percentage
Sourcepub fn needs_replacement(&self) -> bool
pub fn needs_replacement(&self) -> bool
Check if battery needs replacement (>20% wear or <80% health)
Sourcepub fn capacity_wh(&self) -> Option<f32>
pub fn capacity_wh(&self) -> Option<f32>
Get current capacity in Wh (used by power estimation)
Sourcepub fn charge_percent(&self) -> f32
pub fn charge_percent(&self) -> f32
Get charge percentage (alias for percentage)
Trait Implementations§
Source§impl Clone for BatteryInfo
impl Clone for BatteryInfo
Source§fn clone(&self) -> BatteryInfo
fn clone(&self) -> BatteryInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BatteryInfo
impl Debug for BatteryInfo
Source§impl<'de> Deserialize<'de> for BatteryInfo
impl<'de> Deserialize<'de> for BatteryInfo
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
Auto Trait Implementations§
impl Freeze for BatteryInfo
impl RefUnwindSafe for BatteryInfo
impl Send for BatteryInfo
impl Sync for BatteryInfo
impl Unpin for BatteryInfo
impl UnwindSafe for BatteryInfo
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