[−][src]Struct battery::Battery
Battery instant information representation.
Consequent calls of the same method will return the same value.
Methods
impl Battery
[src]
pub fn percentage(&self) -> f32
[src]
The amount of energy left in the battery expressed as a percentage between 0.0
and 100.0
.
pub fn energy(&self) -> u32
[src]
Amount of energy (measured in mWh
) currently available in the battery.
pub fn energy_full(&self) -> u32
[src]
Amount of energy (measured in mWh
) in the battery when it's considered full.
pub fn energy_full_design(&self) -> u32
[src]
Amount of energy (measured in mWh
) the battery is designed to hold when it's considered full.
pub fn energy_rate(&self) -> u32
[src]
Amount of energy being drained from the battery, measured in mW
.
pub fn voltage(&self) -> u32
[src]
Gets a battery voltage (in mV
).
pub fn capacity(&self) -> f32
[src]
Gets battery capacity in 0.0..100.0
percents range.
pub fn state(&self) -> State
[src]
Gets battery current state.
See State enum for possible values.
pub fn technology(&self) -> Technology
[src]
Gets battery technology.
See Technology enum for possible values.
Compatibility
- For MacOS this method always returns
Technology::Unknown
. This behavior might change later.
pub fn temperature(&self) -> Option<f32>
[src]
Gets battery temperature in Celsius degrees.
Compatibility
- For FreeBSD this method always returns
None
. This behavior might change later.
pub fn cycle_count(&self) -> Option<u32>
[src]
Number of charge/discharge cycles
Compatibility
- For FreeBSD this method always returns
None
. This behavior might change later.
pub fn vendor(&self) -> Option<&str>
[src]
Gets battery vendor.
pub fn model(&self) -> Option<&str>
[src]
Gets battery model.
pub fn serial_number(&self) -> Option<&str>
[src]
Gets battery serial number.
pub fn time_to_full(&self) -> Option<Duration>
[src]
Gets a 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<Duration>
[src]
Gets a 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
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,