[][src]Struct mag::Temperature

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

A measurement of thermodynamic temperature.

Temperature is a base quantity with a specific unit.

Operations

  • Temperature + Temperature => Temperature
  • Temperature - Temperature => Temperature
  • f64 * unit => Temperature

Units must be the same for operations with two Temperature operands. The to method can be used for conversion.

use mag::temp::{DegC, DegF};

let a = 72.5 * DegF;
let b = 100.0 * DegC;

assert_eq!(a.to_string(), "72.5 °F");
assert_eq!(b.to_string(), "100 °C");

Fields

quantity: f64

Temperature quantity

Methods

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

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

Create a new temperature measurement

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

Convert to specified units

Trait Implementations

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

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

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

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

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

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

type Output = Self

The resulting type after applying the - operator.

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

type Output = Self

The resulting type after applying the + operator.

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

Auto Trait Implementations

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

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

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

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

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