Struct measurements::volume::Volume [−][src]
pub struct Volume { /* 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]
impl Volume
pub fn from_liters(liters: f64) -> Self
[src]
pub fn from_liters(liters: f64) -> Self
Create a new Volume from a floating point value in Liters (l)
pub fn from_litres(liters: f64) -> Self
[src]
pub fn from_litres(liters: f64) -> Self
Create a new Volume from a floating point value in Litres (l)
pub fn from_cubic_centimeters(cubic_centimeters: f64) -> Self
[src]
pub fn from_cubic_centimeters(cubic_centimeters: f64) -> Self
Create a new Volume from a floating point value in Cubic Centimeters (cc or cm³)
pub fn from_cubic_centimetres(cubic_centimeters: f64) -> Self
[src]
pub fn from_cubic_centimetres(cubic_centimeters: f64) -> Self
Create a new Volume from a floating point value in Cubic Centimetres (cc or cm³)
pub fn from_milliliters(milliliters: f64) -> Self
[src]
pub fn from_milliliters(milliliters: f64) -> Self
Create a new Volume from a floating point value in Milliliters (ml)
pub fn from_millilitres(milliliters: f64) -> Self
[src]
pub fn from_millilitres(milliliters: f64) -> Self
Create a new Volume from a floating point value in Millilitres (ml)
pub fn from_cubic_meters(cubic_meters: f64) -> Self
[src]
pub fn from_cubic_meters(cubic_meters: f64) -> Self
Create a new Volume from a floating point value in Cubic Meters (m³)
pub fn from_cubic_metres(cubic_meters: f64) -> Self
[src]
pub fn from_cubic_metres(cubic_meters: f64) -> Self
Create a new Volume from a floating point value in Cubic Metres (m³)
pub fn from_drops(drops: f64) -> Self
[src]
pub fn from_drops(drops: f64) -> Self
Create a new Volume from a floating point value in Drops
pub fn from_drams(drams: f64) -> Self
[src]
pub fn from_drams(drams: f64) -> Self
Create a new Volume from a floating point value in US Fluid Drams
pub fn from_teaspoons(teaspoons: f64) -> Self
[src]
pub fn from_teaspoons(teaspoons: f64) -> Self
Create a new Volume from a floating point value in Teaspoons (tsp)
pub fn from_tablespoons(tablespoons: f64) -> Self
[src]
pub fn from_tablespoons(tablespoons: f64) -> Self
Create a new Volume from a floating point value in Tablespoons (tbsp)
pub fn from_fluid_ounces_uk(fluid_ounces_uk: f64) -> Self
[src]
pub fn from_fluid_ounces_uk(fluid_ounces_uk: f64) -> Self
Create a new Volume from a floating point value in UK Fluid Ounces (fl oz)
pub fn from_fluid_ounces(fluid_ounces: f64) -> Self
[src]
pub fn from_fluid_ounces(fluid_ounces: f64) -> Self
Create a new Volume from a floating point value in US Fluid Ounces (fl oz)
pub fn from_cubic_inches(cubic_inches: f64) -> Self
[src]
pub fn from_cubic_inches(cubic_inches: f64) -> Self
Create a new Volume from a floating point value in Cubic Inches (cu in or in³)
pub fn from_cups(cups: f64) -> Self
[src]
pub fn from_cups(cups: f64) -> Self
Create a new Volume from a floating point value in Cups
pub fn from_pints(pints: f64) -> Self
[src]
pub fn from_pints(pints: f64) -> Self
Create a new Volume from a floating point value in US Pints
pub fn from_pints_uk(pints_uk: f64) -> Self
[src]
pub fn from_pints_uk(pints_uk: f64) -> Self
Create a new Volume from a floating point value in UK Pints
pub fn from_quarts(quarts: f64) -> Self
[src]
pub fn from_quarts(quarts: f64) -> Self
Create a new Volume from a floating point value in Quarts
pub fn from_gallons(gallons: f64) -> Self
[src]
pub fn from_gallons(gallons: f64) -> Self
Create a new Volume from a floating point value in US Gallons (gal US)
pub fn from_gallons_uk(gallons_uk: f64) -> Self
[src]
pub fn from_gallons_uk(gallons_uk: f64) -> Self
Create a new Volume from a floating point value in UK/Imperial Gallons (gal)
pub fn from_cubic_feet(cubic_feet: f64) -> Self
[src]
pub fn from_cubic_feet(cubic_feet: f64) -> Self
Create a new Volume from a floating point value in Cubic Feet (ft³)
pub fn from_cubic_yards(cubic_yards: f64) -> Self
[src]
pub fn from_cubic_yards(cubic_yards: f64) -> Self
Create a new Volume from a floating point value in Cubic Yards (yd³)
pub fn as_cubic_centimeters(&self) -> f64
[src]
pub fn as_cubic_centimeters(&self) -> f64
Convert Volume to a floating point value in Cubic Centimeters (cc or cm³)
pub fn as_cubic_centimetres(&self) -> f64
[src]
pub fn as_cubic_centimetres(&self) -> f64
Convert Volume to a floating point value in Cubic Centimetres (cc or cm³)
pub fn as_milliliters(&self) -> f64
[src]
pub fn as_milliliters(&self) -> f64
Convert Volume to a floating point value in Milliliters (ml)
pub fn as_millilitres(&self) -> f64
[src]
pub fn as_millilitres(&self) -> f64
Convert Volume to a floating point value in Millilitres (ml)
pub fn as_liters(&self) -> f64
[src]
pub fn as_liters(&self) -> f64
Convert Volume to a floating point value in Liters (l)
pub fn as_litres(&self) -> f64
[src]
pub fn as_litres(&self) -> f64
Convert Volume to a floating point value in Litres (l)
pub fn as_cubic_meters(&self) -> f64
[src]
pub fn as_cubic_meters(&self) -> f64
Convert Volume to a floating point value in Cubic Meters (m³)
pub fn as_cubic_metres(&self) -> f64
[src]
pub fn as_cubic_metres(&self) -> f64
Convert Volume to a floating point value in Cubic Metres (m³)
pub fn as_drops(&self) -> f64
[src]
pub fn as_drops(&self) -> f64
Convert Volume to a floating point value in Drops
pub fn as_drams(&self) -> f64
[src]
pub fn as_drams(&self) -> f64
Convert Volume to a floating point value in US Fluid Drams
pub fn as_teaspoons(&self) -> f64
[src]
pub fn as_teaspoons(&self) -> f64
Convert Volume to a floating point value in Teaspoons (tsp)
pub fn as_tablespoons(&self) -> f64
[src]
pub fn as_tablespoons(&self) -> f64
Convert Volume to a floating point value in Tablespoons (tbsp)
pub fn as_cubic_inches(&self) -> f64
[src]
pub fn as_cubic_inches(&self) -> f64
Convert Volume to a floating point value in Cubic Inches (cu in or in³)
pub fn as_fluid_ounces_uk(&self) -> f64
[src]
pub fn as_fluid_ounces_uk(&self) -> f64
Convert Volume to a floating point value in UK Fluid Ounces (fl oz)
pub fn as_fluid_ounces(&self) -> f64
[src]
pub fn as_fluid_ounces(&self) -> f64
Convert Volume to a floating point value in US Fluid Ounces (fl oz)
pub fn as_cups(&self) -> f64
[src]
pub fn as_cups(&self) -> f64
Convert Volume to a floating point value in Cups
pub fn as_pints(&self) -> f64
[src]
pub fn as_pints(&self) -> f64
Convert Volume to a floating point value in US Pints
pub fn as_pints_uk(&self) -> f64
[src]
pub fn as_pints_uk(&self) -> f64
Convert Volume to a floating point value in UK Pints
pub fn as_quarts(&self) -> f64
[src]
pub fn as_quarts(&self) -> f64
Convert Volume to a floating point value in Quarts
pub fn as_gallons(&self) -> f64
[src]
pub fn as_gallons(&self) -> f64
Convert Volume to a floating point value in US Gallons (gal us)
pub fn as_gallons_uk(&self) -> f64
[src]
pub fn as_gallons_uk(&self) -> f64
Convert Volume to a floating point value in UK/Imperial Gallons (gal)
pub fn as_cubic_feet(&self) -> f64
[src]
pub fn as_cubic_feet(&self) -> f64
Convert Volume to a floating point value in Cubic Feet (ft³)
pub fn as_cubic_yards(&self) -> f64
[src]
pub fn as_cubic_yards(&self) -> f64
Convert Volume to a floating point value in Cubic Yards (yd³)
Trait Implementations
impl Copy for Volume
[src]
impl Copy for Volume
impl Clone for Volume
[src]
impl Clone for Volume
fn clone(&self) -> Volume
[src]
fn clone(&self) -> Volume
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Volume
[src]
impl Debug for Volume
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Measurement for Volume
[src]
impl Measurement for Volume
fn as_base_units(&self) -> f64
[src]
fn as_base_units(&self) -> f64
Get this quantity in the base units
fn from_base_units(units: f64) -> Self
[src]
fn from_base_units(units: f64) -> Self
Create a new quantity from the base units
fn get_base_units_name(&self) -> &'static str
[src]
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example "kilograms" Read more
fn get_appropriate_units(&self) -> (&'static str, f64)
[src]
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
fn pick_appropriate_units(
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
[src]
fn pick_appropriate_units(
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
Given a list of units and their scale relative to the base unit, select the most appropriate one. Read more
impl Display for Volume
[src]
impl Display for Volume
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Add for Volume
[src]
impl Add for Volume
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
fn add(self, rhs: Self) -> Self
Performs the +
operation.
impl Sub for Volume
[src]
impl Sub for Volume
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
fn sub(self, rhs: Self) -> Self
Performs the -
operation.
impl Div<Volume> for Volume
[src]
impl Div<Volume> for Volume
type Output = f64
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> f64
[src]
fn div(self, rhs: Self) -> f64
Performs the /
operation.
impl Div<f64> for Volume
[src]
impl Div<f64> for Volume
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: f64) -> Self
[src]
fn div(self, rhs: f64) -> Self
Performs the /
operation.
impl Mul<f64> for Volume
[src]
impl Mul<f64> for Volume
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f64) -> Self
[src]
fn mul(self, rhs: f64) -> Self
Performs the *
operation.
impl Mul<Volume> for f64
[src]
impl Mul<Volume> for f64
type Output = Volume
The resulting type after applying the *
operator.
fn mul(self, rhs: Volume) -> Volume
[src]
fn mul(self, rhs: Volume) -> Volume
Performs the *
operation.
impl Eq for Volume
[src]
impl Eq for Volume
impl PartialEq for Volume
[src]
impl PartialEq for Volume
fn eq(&self, other: &Self) -> bool
[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[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialOrd for Volume
[src]
impl PartialOrd for Volume
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[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[src]
fn lt(&self, other: &Rhs) -> bool
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[src]
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
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
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[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Div<Area> for Volume
[src]
impl Div<Area> for Volume
type Output = Length
The resulting type after applying the /
operator.
fn div(self, rhs: Area) -> Self::Output
[src]
fn div(self, rhs: Area) -> Self::Output
Performs the /
operation.
impl Div<Length> for Volume
[src]
impl Div<Length> for Volume