[][src]Struct acpi_client::battery::BatteryInfo

pub struct BatteryInfo {
    pub name: String,
    pub remaining_capacity: u32,
    pub present_rate: u32,
    pub voltage: u32,
    pub design_capacity: u32,
    pub last_capacity: u32,
    pub time_remaining: Duration,
    pub percentage: f32,
    pub state: ChargingState,
}

Metadata pertaining to a battery.

Fields

name: String

The name used by ACPI to refer to the device.

remaining_capacity: u32

The charge remaining in the battery in units of mAh.

present_rate: u32

The rate at which the charge of the battery is changing in mA.

voltage: u32

The current voltage of the battery in mV.

design_capacity: u32

The charge available in the battery at the time of manufacture in units of mAh.

last_capacity: u32

The charge available in the battery at the last time the device was charged to full in units of mAh.

time_remaining: Duration

The time remaining until the battery reaches full charge or empty.

percentage: f32

The ratio of the remaining charge to the full charge.

state: ChargingState

The state of the battery's charging.

Methods

impl BatteryInfo[src]

pub fn new(path: &Path) -> Result<BatteryInfo, Box<dyn Error>>[src]

Returns a battery corresponding to a given ACPI device path.

Arguments

  • path - The path to the ACPI device.

Example

let directory = std::path::Path::new("/sys/class/power_supply/BAT1");
let ps_info = acpi_client::BatteryInfo::new(&directory);

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.