[][src]Struct mag::Area

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

A measurement of physical area.

Area is a derived quantity with a specific unit squared.

Operations

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

Example

use mag::length::m;

let a = 150.0 * m * m; // Area<m>
let b = (10.0 * m) * (15.0 * m); // Area<m>

assert_eq!(a, b);
assert_eq!(a.to_string(), "150 m²");
assert_eq!(a / (5.0 * m), 30.0 * m);

Fields

quantity: f64

Area quantity

Methods

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

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

Create a new area measurement

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

Convert to specified units

Trait Implementations

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

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

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

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

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

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

type Output = Self

The resulting type after applying the / operator.

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

type Output = Length<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<Area<U>> for Area<U> where
    U: Unit
[src]

type Output = Self

The resulting type after applying the - operator.

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

type Output = Self

The resulting type after applying the + operator.

impl Mul<km> for Area<km>[src]

type Output = Volume<km>

The resulting type after applying the * operator.

impl Mul<m> for Area<m>[src]

type Output = Volume<m>

The resulting type after applying the * operator.

impl Mul<dm> for Area<dm>[src]

type Output = Volume<dm>

The resulting type after applying the * operator.

impl Mul<cm> for Area<cm>[src]

type Output = Volume<cm>

The resulting type after applying the * operator.

impl Mul<mm> for Area<mm>[src]

type Output = Volume<mm>

The resulting type after applying the * operator.

impl Mul<um> for Area<um>[src]

type Output = Volume<um>

The resulting type after applying the * operator.

impl Mul<nm> for Area<nm>[src]

type Output = Volume<nm>

The resulting type after applying the * operator.

impl Mul<mi> for Area<mi>[src]

type Output = Volume<mi>

The resulting type after applying the * operator.

impl Mul<ft> for Area<ft>[src]

type Output = Volume<ft>

The resulting type after applying the * operator.

impl Mul<In> for Area<In>[src]

type Output = Volume<In>

The resulting type after applying the * operator.

impl Mul<yd> for Area<yd>[src]

type Output = Volume<yd>

The resulting type after applying the * operator.

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

type Output = Self

The resulting type after applying the * operator.

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

type Output = Area<U>

The resulting type after applying the * operator.

impl<U> Mul<Length<U>> for Area<U> where
    U: Unit
[src]

type Output = Volume<U>

The resulting type after applying the * operator.

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

Auto Trait Implementations

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

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

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

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

impl<U> RefUnwindSafe for Area<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]