Struct measurements::Weight
[−]
[src]
pub struct Weight { /* fields omitted */ }
The Weight
struct can be used to deal with weights in a common way.
Example
use measurements::Weight; let metric_ton = Weight::from_metric_tons(1.0); let united_states_tons = metric_ton.as_short_tons(); let united_states_pounds = metric_ton.as_pounds(); println!("One metric ton is {} U.S. tons - that's {} pounds!", united_states_tons, united_states_pounds);
Methods
impl Weight
[src]
fn from_kilograms(kilograms: f64) -> Self
fn from_micrograms(micrograms: f64) -> Self
fn from_milligrams(milligrams: f64) -> Self
fn from_carats(carats: f64) -> Self
fn from_grams(grams: f64) -> Self
fn from_metric_tons(metric_tons: f64) -> Self
fn from_grains(grains: f64) -> Self
fn from_pennyweights(pennyweights: f64) -> Self
fn from_ounces(ounces: f64) -> Self
fn from_troy_ounces(troy_ounces: f64) -> Self
fn from_pounds(pounds: f64) -> Self
fn from_troy_pounds(troy_pounds: f64) -> Self
fn from_stones(stones: f64) -> Self
fn from_short_tons(short_tons: f64) -> Self
fn from_long_tons(long_tons: f64) -> Self
fn as_micrograms(&self) -> f64
fn as_milligrams(&self) -> f64
fn as_carats(&self) -> f64
fn as_grams(&self) -> f64
fn as_kilograms(&self) -> f64
fn as_metric_tons(&self) -> f64
fn as_grains(&self) -> f64
fn as_pennyweights(&self) -> f64
fn as_ounces(&self) -> f64
fn as_pounds(&self) -> f64
fn as_troy_ounces(&self) -> f64
fn as_troy_pounds(&self) -> f64
fn as_stones(&self) -> f64
fn as_short_tons(&self) -> f64
fn as_long_tons(&self) -> f64
Trait Implementations
impl Copy for Weight
[src]
impl Clone for Weight
[src]
fn clone(&self) -> Weight
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Weight
[src]
impl Measurement for Weight
[src]
fn get_base_units(&self) -> f64
fn from_base_units(units: f64) -> Self
impl Add for Weight
[src]
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: Self) -> Self
The method for the +
operator
impl Sub for Weight
[src]
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: Self) -> Self
The method for the -
operator
impl Div<Weight> for Weight
[src]
type Output = f64
The resulting type after applying the /
operator
fn div(self, rhs: Self) -> f64
The method for the /
operator
impl Div<f64> for Weight
[src]
type Output = Self
The resulting type after applying the /
operator
fn div(self, rhs: f64) -> Self
The method for the /
operator
impl Mul<Weight> for Weight
[src]
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: Self) -> Self
The method for the *
operator
impl Mul<f64> for Weight
[src]
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: f64) -> Self
The method for the *
operator
impl Eq for Weight
[src]
impl PartialEq for Weight
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd for Weight
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more