[][src]Struct tiny_uom::Unit

pub struct Unit { /* fields omitted */ }

The Unit struct can represent every possible unit that is defined in the SI system.

It is able to do so because it contains a list of all 7 base units and a number which represents the exponent of that unit.

Example

Newton

kg * m * s⁻²

would be represented using the following Unit:

Unit {
    m: 1,
    kg: 1,
    s: -2,
}

Implementations

impl Unit[src]

pub const fn inv(self) -> Self[src]

Invert this unit by negating all exponents.

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

Multiply two units and return the resulting unit.

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

Divide two units and return the resulting unit.

Trait Implementations

impl Clone for Unit[src]

impl Copy for Unit[src]

impl Debug for Unit[src]

impl Display for Unit[src]

impl Div<Unit> for Unit[src]

type Output = Self

The resulting type after applying the / operator.

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

Divides two units by substracting their exponents.

impl Eq for Unit[src]

impl Mul<Unit> for Unit[src]

type Output = Self

The resulting type after applying the * operator.

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

Multiplies two units by adding their exponents.

impl PartialEq<Unit> for Unit[src]

impl StructuralEq for Unit[src]

impl StructuralPartialEq for Unit[src]

Auto Trait Implementations

impl RefUnwindSafe for Unit

impl Send for Unit

impl Sync for Unit

impl Unpin for Unit

impl UnwindSafe for Unit

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.