Struct lsm::Battery [] [src]

pub struct Battery {
    pub id: String,
    pub name: String,
    pub battery_type: BatteryType,
    pub status: u64,
    pub system_id: String,
    // some fields omitted
}

Represent a battery.

Fields

Identifier.

Human friendly name.

Battery type.

Battery status stored in bitmap. Valid status value are:

if (b.status & Battery::STATUS_OK) == 0 {
    println!("Battery {}/{} is not healthy", b.name, b.id);
}

Identifier of owner system.

Methods

impl Battery
[src]

STATUS_UNKNOWN: u64 = 1

Plugin failed to query battery status.

STATUS_OTHER: u64 = 1 << 1

Vendor specific status.

STATUS_OK: u64 = 1 << 2

Battery is healthy and charged.

STATUS_DISCHARGING: u64 = 1 << 3

Battery is disconnected from power source and discharging.

STATUS_CHARGING: u64 = 1 << 4

Battery is not fully charged and charging.

STATUS_LEARNING: u64 = 1 << 5

System is trying to discharge and recharge the battery to learn its capability.

STATUS_DEGRADED: u64 = 1 << 6

Battery is degraded and should be checked or replaced.

STATUS_ERROR: u64 = 1 << 7

Battery is dead and should be replaced.

Trait Implementations

impl Debug for Battery
[src]

[src]

Formats the value using the given formatter.

impl Clone for Battery
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more