[−][src]Struct macsmc::BatteryDetail
Various information about the battery in detail
Fields
cycles: u32
The number of charging cycles of the battery
current_capacity: MilliAmpereHours
The current capacity ("charge") of the battery
full_capacity: MilliAmpereHours
The capacity ("charge") of the battery if it was at 100%. This is different from the intial design capacity. It naturally decreases over the lifetime of the battery, meaning that older batteries cannot hold as much charge anyumore.
amperage: MilliAmpere
The Current (amperage) on this battery
Named amperage
instead of current
to prevent confusion with "current charge".
voltage: Volt
The voltage on this battery
power: Watt
If this is a positive value, it's the power delivered of this battery. If this is a negative value, it's the rate at which this battery is being charged.
Implementations
impl BatteryDetail
[src]
pub fn percentage(&self) -> f32
[src]
The current charge as a percentage. Value is between 0.0 and 100.0
Examples
let battery = BatteryDetail { current_capacity: MilliAmpereHours(1000), full_capacity: MilliAmpereHours(5000), ..BatteryDetail::default() }; assert_eq!(battery.percentage(), 20.0);
pub fn time_remaining(&self) -> Option<Duration>
[src]
How much time is remaining on battery, based on the current current (amperage).
This is not checking if the system is marked as being "powered by battery".
This only operates based on the value of amperage
.
Returns None
if the battery is draining.
pub fn time_until_full(&self) -> Option<Duration>
[src]
How long it will take to load the battery based on the current current (amperage).
This is not checking if the battery is marked as "being charged".
This only operates based on the value of amperage
.
Returns None
if the battery is not charging.
Trait Implementations
impl Clone for BatteryDetail
[src]
fn clone(&self) -> BatteryDetail
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for BatteryDetail
[src]
impl Debug for BatteryDetail
[src]
impl Default for BatteryDetail
[src]
fn default() -> BatteryDetail
[src]
impl PartialEq<BatteryDetail> for BatteryDetail
[src]
fn eq(&self, other: &BatteryDetail) -> bool
[src]
fn ne(&self, other: &BatteryDetail) -> bool
[src]
impl StructuralPartialEq for BatteryDetail
[src]
Auto Trait Implementations
impl RefUnwindSafe for BatteryDetail
impl Send for BatteryDetail
impl Sync for BatteryDetail
impl Unpin for BatteryDetail
impl UnwindSafe for BatteryDetail
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,