pub struct Battery {
pub id: String,
pub name: String,
pub battery_type: BatteryType,
pub status: u64,
pub system_id: String,
/* private fields */
}
Expand description
Represent a battery.
Fields§
§id: String
Identifier.
name: String
Human friendly name.
battery_type: BatteryType
Battery type.
status: u64
Battery status stored in bitmap. Valid status value are:
Battery::STATUS_UNKNOWN
Battery::STATUS_OTHER
Battery::STATUS_OK
Battery::STATUS_DISCHARGING
Battery::STATUS_CHARGING
Battery::STATUS_LEARNING
Battery::STATUS_DEGRADED
Battery::STATUS_ERROR
if (b.status & Battery::STATUS_OK) == 0 {
println!("Battery {}/{} is not healthy", b.name, b.id);
}
system_id: String
Identifier of owner system.
Implementations§
source§impl Battery
impl Battery
sourcepub const STATUS_UNKNOWN: u64 = 1u64
pub const STATUS_UNKNOWN: u64 = 1u64
Plugin failed to query battery status.
sourcepub const STATUS_OTHER: u64 = 2u64
pub const STATUS_OTHER: u64 = 2u64
Vendor specific status.
sourcepub const STATUS_DISCHARGING: u64 = 8u64
pub const STATUS_DISCHARGING: u64 = 8u64
Battery is disconnected from power source and discharging.
sourcepub const STATUS_CHARGING: u64 = 16u64
pub const STATUS_CHARGING: u64 = 16u64
Battery is not fully charged and charging.
sourcepub const STATUS_LEARNING: u64 = 32u64
pub const STATUS_LEARNING: u64 = 32u64
System is trying to discharge and recharge the battery to learn its capability.
sourcepub const STATUS_DEGRADED: u64 = 64u64
pub const STATUS_DEGRADED: u64 = 64u64
Battery is degraded and should be checked or replaced.
sourcepub const STATUS_ERROR: u64 = 128u64
pub const STATUS_ERROR: u64 = 128u64
Battery is dead and should be replaced.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Battery
impl<'de> Deserialize<'de> for Battery
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 Battery
impl RefUnwindSafe for Battery
impl Send for Battery
impl Sync for Battery
impl Unpin for Battery
impl UnwindSafe for Battery
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)