[][src]Struct tiny_uom::Quantity

#[repr(transparent)]pub struct Quantity<const U: Unit> {
    pub value: f64,
}

A Quantity represents a raw value and it's unit that is represented as a const generic parameter.

Fields

value: f64

The raw value of this Quantity

Implementations

impl<const U: Unit> Quantity<U>[src]

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

Create a new Quantity with the given value.

Trait Implementations

impl<const U: Unit> Add<Quantity<U>> for Quantity<U>[src]

type Output = Self

The resulting type after applying the + operator.

pub fn add(self, rhs: Self) -> Self::Output[src]

Add the value of two equal units.

impl<const U: Unit> AddAssign<Quantity<U>> for Quantity<U>[src]

pub fn add_assign(&mut self, rhs: Self)[src]

Add the value of two equal units.

impl<const U: Unit> Clone for Quantity<U>[src]

impl<const U: Unit> Copy for Quantity<U>[src]

impl<const U: Unit> Debug for Quantity<U>[src]

impl<const U: Unit> Display for Quantity<U>[src]

impl<const L: Unit, const R: Unit> Div<Quantity<R>> for Quantity<L> where
    Quantity<{ L.div(R) }>: , 
[src]

type Output = Quantity<{ L.div(R) }>

The resulting type after applying the / operator.

pub fn div(self, rhs: Quantity<R>) -> Self::Output[src]

Divides two units and their values.

impl<const U: Unit> Div<Quantity<U>> for f64 where
    Quantity<{ U.inv() }>: , 
[src]

type Output = Quantity<{ U.inv() }>

The resulting type after applying the / operator.

impl<const U: Unit> Div<f64> for Quantity<U>[src]

type Output = Self

The resulting type after applying the / operator.

pub fn div(self, rhs: f64) -> Self::Output[src]

Divides the value of this unit with a number.

impl<const U: Unit> DivAssign<f64> for Quantity<U>[src]

pub fn div_assign(&mut self, rhs: f64)[src]

Divides the value of this unit with a number.

impl<const L: Unit, const R: Unit> Mul<Quantity<R>> for Quantity<L> where
    Quantity<{ L.mul(R) }>: , 
[src]

type Output = Quantity<{ L.mul(R) }>

The resulting type after applying the * operator.

pub fn mul(self, rhs: Quantity<R>) -> Self::Output[src]

Multiply two units and their values

impl<const U: Unit> Mul<Quantity<U>> for f64[src]

type Output = Quantity<U>

The resulting type after applying the * operator.

pub fn mul(self, rhs: Quantity<U>) -> Self::Output[src]

Multiply the value of this unit with a number.

impl<const U: Unit> Mul<f64> for Quantity<U>[src]

type Output = Self

The resulting type after applying the * operator.

pub fn mul(self, rhs: f64) -> Self::Output[src]

Multiply the value of this unit with a number.

impl<const U: Unit> MulAssign<f64> for Quantity<U>[src]

pub fn mul_assign(&mut self, rhs: f64)[src]

Multiply the value of this unit with a number.

impl<const U: Unit> PartialEq<Quantity<U>> for Quantity<U>[src]

impl<const U: Unit> StructuralPartialEq for Quantity<U>[src]

impl<const U: Unit> Sub<Quantity<U>> for Quantity<U>[src]

type Output = Self

The resulting type after applying the - operator.

pub fn sub(self, rhs: Self) -> Self::Output[src]

Subtract the value of two equal units.

impl<const U: Unit> SubAssign<Quantity<U>> for Quantity<U>[src]

pub fn sub_assign(&mut self, rhs: Self)[src]

Subtract the value of two equal units.

Auto Trait Implementations

impl<const U: Unit> RefUnwindSafe for Quantity<U>

impl<const U: Unit> Send for Quantity<U>

impl<const U: Unit> Sync for Quantity<U>

impl<const U: Unit> Unpin for Quantity<U>

impl<const U: Unit> UnwindSafe for Quantity<U>

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.