[][src]Struct battery::Battery

pub struct Battery(_)
where
    PowerDevice: BatteryDevice
;

Battery instant information representation.

Consequent calls of the same method will return the same value.
See the Manager::refresh method, which can be used to update information hold in the current Battery.

Almost all methods are returning values in the SI measurement units, represented as a units from the uom crate.
If you are unfamiliar with uom, check the units module documentation for a few examples of how to get the values from them.

Implementations

impl Battery[src]

pub fn state_of_charge(&self) -> Ratio[src]

Battery state of charge.

The State of Charge (or SOC) is an expression of the battery capacity as a percentage of maximum capacity.

In plain english: it is how much energy your battery has (expressed in percents). This is an exactly that value which operating systems and desktop managers are displaying in the taskbar near the clock.

Roughly it can be calculated as battery.energy() / battery.energy_full(), but you should always use Battery::state_of_charge instead of the manual calculation, because many device drivers are providing this value more precisely, and this method takes that into account.

See also:

pub fn energy(&self) -> Energy[src]

Amount of energy currently available in the battery.

pub fn energy_full(&self) -> Energy[src]

Amount of energy in the battery when it's considered full.

pub fn energy_full_design(&self) -> Energy[src]

Amount of energy the battery is designed to hold when it's considered full.

pub fn energy_rate(&self) -> Power[src]

Amount of energy being drained from the battery.

pub fn voltage(&self) -> ElectricPotential[src]

Battery voltage.

pub fn state_of_health(&self) -> Ratio[src]

Gets battery state of health.

The State of Health (or SOH) is an indication of the point which has been reached in the life cycle of the battery and a measure of its condition relative to a fresh battery.

In plain english: this is how much energy in percents your battery can hold when fully charged. New battery - 100 %, old and degraded battery - notably lower amount of percents. See also:

pub fn state(&self) -> State[src]

Battery current state.

See State enum for possible values.

pub fn technology(&self) -> Technology[src]

Battery technology.

See Technology enum for possible values.

pub fn temperature(&self) -> Option<ThermodynamicTemperature>[src]

Battery temperature.

pub fn cycle_count(&self) -> Option<u32>[src]

Number of charge/discharge cycles.

pub fn vendor(&self) -> Option<&str>[src]

Battery vendor.

pub fn model(&self) -> Option<&str>[src]

Battery model.

pub fn serial_number(&self) -> Option<&str>[src]

Battery serial number.

pub fn time_to_full(&self) -> Option<Time>[src]

Remaining time till full battery.

This is an instant value and may different vastly from call to call. Any aggregation should be made by caller.

If battery is not charging at the moment, this method will return None.

pub fn time_to_empty(&self) -> Option<Time>[src]

Remaining time till empty battery.

This is an instant value and may different vastly from call to call. Any aggregation should be made by caller.

If battery is not discharging at the moment, this method will return None.

Trait Implementations

impl Debug for Battery[src]

impl Deref for Battery[src]

type Target = PowerDevice

The resulting type after dereferencing.

impl DerefMut for Battery[src]

Auto Trait Implementations

impl !RefUnwindSafe for Battery

impl Send for Battery

impl Sync for Battery

impl Unpin for Battery

impl !UnwindSafe for Battery

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> Same<T> for T

type Output = T

Should always be Self

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

type Error = Infallible

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.