pub struct Power { /* private fields */ }Expand description
The Power struct can be used to deal with energies in a common way.
Common metric and imperial units are supported.
§Example
use measurements::Power;
let power = Power::from_horsepower(100.0);
let k_w = power.as_kilowatts();
println!("A 100.0 hp car produces {} kW", k_w);Implementations§
Source§impl Power
impl Power
Sourcepub fn from_watts(watts: f64) -> Power
pub fn from_watts(watts: f64) -> Power
Create a new Power from a floating point value in Watts
Sourcepub fn from_milliwatts(milliwatts: f64) -> Power
pub fn from_milliwatts(milliwatts: f64) -> Power
Create a new Power from a floating point value in milliwatts
Sourcepub fn from_microwatts(microwatts: f64) -> Power
pub fn from_microwatts(microwatts: f64) -> Power
Create a new Power from a floating point value in microwatts
Sourcepub fn from_horsepower(horsepower: f64) -> Power
pub fn from_horsepower(horsepower: f64) -> Power
Create a new Power from a floating point value in horsepower (hp)
Sourcepub fn from_ps(ps: f64) -> Power
pub fn from_ps(ps: f64) -> Power
Create a new Power from a floating point value in metric horsepower (PS)
Sourcepub fn from_metric_horsepower(metric_horsepower: f64) -> Power
pub fn from_metric_horsepower(metric_horsepower: f64) -> Power
Create a new Power from a floating point value in metric horsepower (PS)
Sourcepub fn from_btu_per_minute(btu_per_minute: f64) -> Power
pub fn from_btu_per_minute(btu_per_minute: f64) -> Power
Create a new Power from a floating point value in BTU/mjn
Sourcepub fn from_kilowatts(kw: f64) -> Power
pub fn from_kilowatts(kw: f64) -> Power
Create a new Power from a floating point value in Kilowatts (kW)
Sourcepub fn as_horsepower(&self) -> f64
pub fn as_horsepower(&self) -> f64
Convert this Power into a floating point value in horsepower (hp)
Sourcepub fn as_ps(&self) -> f64
pub fn as_ps(&self) -> f64
Convert this Power into a floating point value in metric horsepower (PS)
Sourcepub fn as_metric_horsepower(&self) -> f64
pub fn as_metric_horsepower(&self) -> f64
Convert this Power into a floating point value in metric horsepower (PS)
Sourcepub fn as_btu_per_minute(&self) -> f64
pub fn as_btu_per_minute(&self) -> f64
Convert this Power into a floating point value in BTU/min
Sourcepub fn as_kilowatts(&self) -> f64
pub fn as_kilowatts(&self) -> f64
Convert this Power into a floating point value in kilowatts (kW)
Sourcepub fn as_milliwatts(&self) -> f64
pub fn as_milliwatts(&self) -> f64
Convert this Power into a floating point value in milliwatts (mW)
Sourcepub fn as_microwatts(&self) -> f64
pub fn as_microwatts(&self) -> f64
Convert this Power into a floating point value in microwatts (µW)