[][src]Trait i3status_rs::blocks::battery::BatteryDevice

pub trait BatteryDevice {
    fn is_available(&self) -> bool;
fn refresh_device_info(&mut self) -> Result<(), Error>;
fn status(&self) -> Result<String, Error>;
fn capacity(&self) -> Result<u64, Error>;
fn time_remaining(&self) -> Result<u64, Error>;
fn power_consumption(&self) -> Result<u64, Error>; }

A battery device can be queried for a few properties relevant to the user.

Required methods

fn is_available(&self) -> bool[src]

Query whether the device is available. Batteries can be hot-swappable and configurations may be used for multiple devices (desktop AND laptop).

fn refresh_device_info(&mut self) -> Result<(), Error>[src]

Logic for getting some static battery specs. An error may be thrown when these specs cannot be found or if the device is unexpectedly missing.

Batteries can be hot-swappable, meaning that they can go away and be replaced with another battery with differrent specs.

fn status(&self) -> Result<String, Error>[src]

Query the device status. One of "Full", "Charging", "Discharging", or "Unknown". Thinkpad batteries also report "Not charging", which for our purposes should be treated as equivalent to full.

fn capacity(&self) -> Result<u64, Error>[src]

Query the device's current capacity, as a percent.

fn time_remaining(&self) -> Result<u64, Error>[src]

Query the estimated time remaining, in minutes, before (dis)charging is complete.

fn power_consumption(&self) -> Result<u64, Error>[src]

Query the current power consumption, in uW.

Loading content...

Implementors

impl BatteryDevice for PowerSupplyDevice[src]

impl BatteryDevice for UpowerDevice[src]

Loading content...