[][src]Trait metfor::Quantity

pub trait Quantity: Copy + Debug + Sized {
    fn pack(_: f64) -> Self;
fn unpack(self) -> f64;
fn unwrap(self) -> f64;
fn into_option(self) -> Option<f64>; fn approx_eq<RHS, TOL>(self, other: RHS, tol: TOL) -> bool
    where
        Self: From<RHS> + From<TOL> + Quantity
, { ... }
fn abs(self) -> Self { ... } }

A quantity is a common super trait for types that represent units of measurement.

Required methods

fn pack(_: f64) -> Self

Create a new instance of self by wrapping a value

fn unpack(self) -> f64

Unpack a wrapped value without any error checking.

fn unwrap(self) -> f64

Unwrap the value from the new type and check for validity, panic if contents are invalid.

fn into_option(self) -> Option<f64>

Convert into an option that is None if the content is invalid.

Loading content...

Provided methods

fn approx_eq<RHS, TOL>(self, other: RHS, tol: TOL) -> bool where
    Self: From<RHS> + From<TOL> + Quantity

Test whether these two values are close

fn abs(self) -> Self

Test whether these two values are close

Loading content...

Implementations on Foreign Types

impl Quantity for f64[src]

impl Quantity for u8[src]

Loading content...

Implementors

impl Quantity for Celsius[src]

impl Quantity for CelsiusDiff[src]

impl Quantity for CelsiusPKm[src]

impl Quantity for Cm[src]

impl Quantity for Decameters[src]

impl Quantity for Fahrenheit[src]

impl Quantity for FahrenheitDiff[src]

impl Quantity for FahrenheitPKft[src]

impl Quantity for Feet[src]

impl Quantity for HectoPascal[src]

impl Quantity for HelicityMpS2[src]

impl Quantity for HydrolapseGPKgPKm[src]

impl Quantity for HydrolapsePKm[src]

impl Quantity for Inches[src]

impl Quantity for IntHelicityM2pS2[src]

impl Quantity for JpKg[src]

impl Quantity for JpKgpK[src]

impl Quantity for Kelvin[src]

impl Quantity for Km[src]

impl Quantity for KmPHour[src]

impl Quantity for Knots[src]

impl Quantity for Meters[src]

impl Quantity for MetersPSec[src]

impl Quantity for MicroBarPS[src]

impl Quantity for MilesPHour[src]

impl Quantity for Millibar[src]

impl Quantity for Mm[src]

impl Quantity for PaPS[src]

impl Quantity for Pascal[src]

impl Quantity for StatuteMiles[src]

Loading content...