Struct measurements::power::Power
source · [−]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
sourceimpl 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)
Trait Implementations
sourceimpl Div<AngularVelocity> for Power
impl Div<AngularVelocity> for Power
sourceimpl Measurement for Power
impl Measurement for Power
sourcefn as_base_units(&self) -> f64
fn as_base_units(&self) -> f64
Get this quantity in the base units
sourcefn from_base_units(units: f64) -> Self
fn from_base_units(units: f64) -> Self
Create a new quantity from the base units
sourcefn get_base_units_name(&self) -> &'static str
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example “kilograms” Read more
sourcefn get_appropriate_units(&self) -> (&'static str, f64)
fn get_appropriate_units(&self) -> (&'static str, f64)
Returns a string containing the most appropriate units for this quantity, and a floating point value representing this quantity in those units. Useful when, for example, a length might be in millimeters if it is very small, or kilometers when it is very large. Read more
sourceimpl PartialOrd<Power> for Power
impl PartialOrd<Power> for Power
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Power
impl Eq for Power
Auto Trait Implementations
impl RefUnwindSafe for Power
impl Send for Power
impl Sync for Power
impl Unpin for Power
impl UnwindSafe for Power
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more