[−][src]Struct tiny_uom::Unit
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,