Struct measurements::pressure::Pressure
source · [−]pub struct Pressure { /* private fields */ }
Expand description
The Pressure
struct can be used to deal with presssures in a common way.
Common metric and imperial units are supported.
Example
use measurements::Pressure;
let earth = Pressure::from_atmospheres(1.0);
let mbar = earth.as_millibars();
println!("Atmospheric pressure is {} mbar.", mbar);
Implementations
sourceimpl Pressure
impl Pressure
sourcepub fn from_pascals(pascals: f64) -> Pressure
pub fn from_pascals(pascals: f64) -> Pressure
Create new Pressure from floating point value in Pascals (Pa)
sourcepub fn from_hectopascals(hectopascals: f64) -> Pressure
pub fn from_hectopascals(hectopascals: f64) -> Pressure
Create new Pressure from floating point value in hectopascals (hPA)
sourcepub fn from_millibars(millibars: f64) -> Pressure
pub fn from_millibars(millibars: f64) -> Pressure
Create new Pressure from floating point value in millibars (mBar)
sourcepub fn from_kilopascals(kilopascals: f64) -> Pressure
pub fn from_kilopascals(kilopascals: f64) -> Pressure
Create new Pressure from floating point value in kilopascals (kPa)
sourcepub fn from_atmospheres(atmospheres: f64) -> Pressure
pub fn from_atmospheres(atmospheres: f64) -> Pressure
Create new Pressure from floating point value in Atmospheres
sourcepub fn as_pascals(&self) -> f64
pub fn as_pascals(&self) -> f64
Convert this Pressure into a floating point value in Pascals
sourcepub fn as_hectopascals(&self) -> f64
pub fn as_hectopascals(&self) -> f64
Convert this Pressure into a floating point value in hectopascals (hPA)
sourcepub fn as_millibars(&self) -> f64
pub fn as_millibars(&self) -> f64
Convert this Pressure into a floating point value in millibars (mBar)
sourcepub fn as_kilopascals(&self) -> f64
pub fn as_kilopascals(&self) -> f64
Convert this Pressure into a floating point value in kilopascals (kPA)
sourcepub fn as_psi(&self) -> f64
pub fn as_psi(&self) -> f64
Convert this Pressure into a floating point value in pounds per square-inch (psi)
sourcepub fn as_atmospheres(&self) -> f64
pub fn as_atmospheres(&self) -> f64
Convert this Pressure into a floating point value in Atmospheres
Trait Implementations
sourceimpl Measurement for Pressure
impl Measurement for Pressure
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<Pressure> for Pressure
impl PartialOrd<Pressure> for Pressure
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 Pressure
impl Eq for Pressure
Auto Trait Implementations
impl RefUnwindSafe for Pressure
impl Send for Pressure
impl Sync for Pressure
impl Unpin for Pressure
impl UnwindSafe for Pressure
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