Struct measurements::Volume [] [src]

pub struct Volume {
    // some fields omitted
}

The Volume struct can be used to deal with volumes in a common way.

Example

use measurements::Volume;
 
let gallon = Volume::from_gallons(1.0);
let pint = Volume::from_pints(1.0);
let beers = gallon / pint;
println!("A gallon of beer will pour {} pints!", beers);

Methods

impl Volume
[src]

fn from_litres(litres: f64) -> Self

fn from_cubic_centimeters(cubic_centimeters: f64) -> Self

fn from_milliliters(milliliters: f64) -> Self

fn from_cubic_meters(cubic_meters: f64) -> Self

fn from_drops(drops: f64) -> Self

fn from_drams(drams: f64) -> Self

fn from_teaspoons(teaspoons: f64) -> Self

fn from_tablespoons(tablespoons: f64) -> Self

fn from_fluid_ounces_uk(fluid_ounces_uk: f64) -> Self

fn from_fluid_ounces(fluid_ounces: f64) -> Self

fn from_cubic_inches(cubic_inches: f64) -> Self

fn from_cups(cups: f64) -> Self

fn from_pints(pints: f64) -> Self

fn from_pints_uk(pints_uk: f64) -> Self

fn from_quarts(quarts: f64) -> Self

fn from_gallons(gallons: f64) -> Self

fn from_gallons_uk(gallons_uk: f64) -> Self

fn from_cubic_feet(cubic_feet: f64) -> Self

fn from_cubic_yards(cubic_yards: f64) -> Self

fn as_cubic_centimeters(&self) -> f64

fn as_milliliters(&self) -> f64

fn as_litres(&self) -> f64

fn as_cubic_meters(&self) -> f64

fn as_drops(&self) -> f64

fn as_drams(&self) -> f64

fn as_teaspoons(&self) -> f64

fn as_tablespoons(&self) -> f64

fn as_cubic_inches(&self) -> f64

fn as_fluid_ounces_uk(&self) -> f64

fn as_fluid_ounces(&self) -> f64

fn as_cups(&self) -> f64

fn as_pints(&self) -> f64

fn as_pints_uk(&self) -> f64

fn as_quarts(&self) -> f64

fn as_gallons(&self) -> f64

fn as_gallons_uk(&self) -> f64

fn as_cubic_feet(&self) -> f64

fn as_cubic_yards(&self) -> f64

Trait Implementations

impl Debug for Volume
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Volume
[src]

fn clone(&self) -> Volume

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 Copy for Volume
[src]

impl Measurement for Volume
[src]

fn get_base_units(&self) -> f64

fn from_base_units(units: f64) -> Self

impl Add for Volume
[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 Volume
[src]

type Output = Self

The resulting type after applying the - operator

fn sub(self, rhs: Self) -> Self

The method for the - operator

impl Div<Volume> for Volume
[src]

Dividing a $t by another $ returns a ratio.

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 Volume
[src]

Dividing a $ by a factor returns a new portion of the measurement.

type Output = Self

The resulting type after applying the / operator

fn div(self, rhs: f64) -> Self

The method for the / operator

impl Mul<Volume> for Volume
[src]

Multiplying a $t by another $t returns the product of those measurements.

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 Volume
[src]

Multiplying a $t by a factor increases (or decreases) that measurement a number of times.

type Output = Self

The resulting type after applying the * operator

fn mul(self, rhs: f64) -> Self

The method for the * operator

impl Eq for Volume
[src]

impl PartialEq for Volume
[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 Volume
[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