pub struct PowerDomain {
pub battery: Option<Battery>,
pub charging: Option<Charging>,
pub power_consumption_w: Option<f64>,
pub average_power_w: Option<f64>,
pub power_source: Option<PowerSource>,
pub voltage_v: Option<f64>,
pub current_a: Option<f64>,
pub estimated_runtime_min: Option<f64>,
pub estimated_range_m: Option<f64>,
}Expand description
Power domain containing battery and charging information.
Fields§
§battery: Option<Battery>Battery information
charging: Option<Charging>Charging information
power_consumption_w: Option<f64>Current power consumption in watts
average_power_w: Option<f64>Average power consumption in watts
power_source: Option<PowerSource>Current power source
voltage_v: Option<f64>System voltage in volts
current_a: Option<f64>System current in amps
estimated_runtime_min: Option<f64>Estimated remaining runtime in minutes
estimated_range_m: Option<f64>Estimated range remaining in meters
Implementations§
Source§impl PowerDomain
impl PowerDomain
Sourcepub fn from_battery(battery: Battery) -> Self
pub fn from_battery(battery: Battery) -> Self
Create a power domain with full battery info.
Sourcepub fn with_charging(self, charging: Charging) -> Self
pub fn with_charging(self, charging: Charging) -> Self
Builder to add charging info.
Sourcepub fn with_consumption(self, power_w: f64) -> Self
pub fn with_consumption(self, power_w: f64) -> Self
Builder to add power consumption.
Sourcepub fn with_runtime_estimate(self, minutes: f64) -> Self
pub fn with_runtime_estimate(self, minutes: f64) -> Self
Builder to add runtime estimate.
Sourcepub fn is_charging(&self) -> bool
pub fn is_charging(&self) -> bool
Convenience: check if charging.
Trait Implementations§
Source§impl Clone for PowerDomain
impl Clone for PowerDomain
Source§fn clone(&self) -> PowerDomain
fn clone(&self) -> PowerDomain
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PowerDomain
impl Debug for PowerDomain
Source§impl Default for PowerDomain
impl Default for PowerDomain
Source§fn default() -> PowerDomain
fn default() -> PowerDomain
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PowerDomain
impl<'de> Deserialize<'de> for PowerDomain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for PowerDomain
impl Serialize for PowerDomain
Auto Trait Implementations§
impl Freeze for PowerDomain
impl RefUnwindSafe for PowerDomain
impl Send for PowerDomain
impl Sync for PowerDomain
impl Unpin for PowerDomain
impl UnwindSafe for PowerDomain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more