[][src]Struct mag::Volume

pub struct Volume<U> where
    U: Unit
{ pub quantity: f64, // some fields omitted }

A measurement of physical volume.

Volume is a derived quantity with a specific unit cubed.

Operations

  • Volume + Volum => Volume
  • Volume - Volume => Volume
  • Volume * f64 => Volume
  • Volume / f64 => Volume
  • Volume / Length => Area
  • Volume / Area => Length

Example

use mag::length::yd;

let a = 2.5 * yd * yd * yd; // Volume<yd>
let b = a / (2.0 * yd); // Area<yd>

assert_eq!(a.to_string(), "2.5 yd³");
assert_eq!(b.to_string(), "1.25 yd²");

Fields

quantity: f64

Volume quantity

Methods

impl<U> Volume<U> where
    U: Unit
[src]

pub fn new(quantity: f64) -> Self[src]

Create a new volume measurement

pub fn to<T: Unit>(self) -> Volume<T>[src]

Convert to specified units

Trait Implementations

impl<U: Clone> Clone for Volume<U> where
    U: Unit
[src]

impl<U: Copy> Copy for Volume<U> where
    U: Unit
[src]

impl<U: PartialEq> PartialEq<Volume<U>> for Volume<U> where
    U: Unit
[src]

impl<U> Display for Volume<U> where
    U: Unit
[src]

impl<U: Debug> Debug for Volume<U> where
    U: Unit
[src]

impl<U> Div<f64> for Volume<U> where
    U: Unit
[src]

type Output = Self

The resulting type after applying the / operator.

impl<U> Div<Length<U>> for Volume<U> where
    U: Unit
[src]

type Output = Area<U>

The resulting type after applying the / operator.

impl<U> Div<Area<U>> for Volume<U> where
    U: Unit
[src]

type Output = Length<U>

The resulting type after applying the / operator.

impl<U> Sub<Volume<U>> for Volume<U> where
    U: Unit
[src]

type Output = Self

The resulting type after applying the - operator.

impl<U> Add<Volume<U>> for Volume<U> where
    U: Unit
[src]

type Output = Self

The resulting type after applying the + operator.

impl<U> Mul<f64> for Volume<U> where
    U: Unit
[src]

type Output = Self

The resulting type after applying the * operator.

impl<U> Mul<Volume<U>> for f64 where
    U: Unit
[src]

type Output = Volume<U>

The resulting type after applying the * operator.

impl<U> StructuralPartialEq for Volume<U> where
    U: Unit
[src]

Auto Trait Implementations

impl<U> Send for Volume<U> where
    U: Send

impl<U> Sync for Volume<U> where
    U: Sync

impl<U> Unpin for Volume<U> where
    U: Unpin

impl<U> UnwindSafe for Volume<U> where
    U: UnwindSafe

impl<U> RefUnwindSafe for Volume<U> where
    U: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]