Struct dimensioned::dimensioned::Dim
[−]
[src]
pub struct Dim<D: Dimension, V>(pub V, pub PhantomData<D>);
This is the primary struct that users of this library will interact with.
Methods
impl<D: Dimension, V> Dim<D, V>
const fn new(v: V) -> Dim<D, V>
Construct a new Dim object.
It is recommened to use this only where necessary, and to generally use the
constants that ship with unit systems to create Dim objects.
Example
use dimensioned::Dim; use dimensioned::si::{m, Meter}; let x: Dim<Meter, f64> = Dim::new(3.0); let y = 3.0*m; assert_eq!(x, y);
fn map<O, F: FnOnce(V) -> O>(self, f: F) -> Dim<D, O>
Map a Dim<D, V> to Dim<D, O> by applying function f to the contained value
Example
use num::traits::Float; use dimensioned::si::m; let x = 3.5*m; assert_eq!(3.0*m, x.map(Float::trunc) );
Trait Implementations
impl<D, V> Sqrt for Dim<D, V> where D: Dimension + Root<P2>, V: Float, D::Output: Dimension
impl<D, V> Cbrt for Dim<D, V> where D: Dimension + Root<P3>, V: Float, D::Output: Dimension
impl<D, V> Recip for Dim<D, V> where D: Dimension + Recip, V: Float, D::Output: Dimension
impl<D, V> Display for Dim<D, V> where D: DimToString, V: Display
impl<D, V> Debug for Dim<D, V> where D: DimToString, V: Debug
impl<D, V> Octal for Dim<D, V> where D: DimToString, V: Octal
impl<D, V> LowerHex for Dim<D, V> where D: DimToString, V: LowerHex
impl<D, V> UpperHex for Dim<D, V> where D: DimToString, V: UpperHex
impl<D, V> Pointer for Dim<D, V> where D: DimToString, V: Pointer
impl<D, V> Binary for Dim<D, V> where D: DimToString, V: Binary
impl<D, V> LowerExp for Dim<D, V> where D: DimToString, V: LowerExp
impl<D, V> UpperExp for Dim<D, V> where D: DimToString, V: UpperExp
impl<Dl, Dr, Vl, Vr> PartialEq<Dim<Dr, Vr>> for Dim<Dl, Vl> where Dl: Dimension + Same<Dr>, Dr: Dimension, Vl: PartialEq<Vr>
impl<D: Dimension + Same, V: Eq> Eq for Dim<D, V>
impl<Dl, Dr, Vl, Vr> PartialOrd<Dim<Dr, Vr>> for Dim<Dl, Vl> where Dl: Dimension + Same<Dr>, Dr: Dimension, Vl: PartialOrd<Vr>
fn partial_cmp(&self, other: &Dim<Dr, Vr>) -> Option<Ordering>
fn lt(&self, other: &Dim<Dr, Vr>) -> bool
fn le(&self, other: &Dim<Dr, Vr>) -> bool
fn gt(&self, other: &Dim<Dr, Vr>) -> bool
fn ge(&self, other: &Dim<Dr, Vr>) -> bool
impl<D: Dimension + Same, V: Ord> Ord for Dim<D, V>
impl<Dl, Dr, Vl, Vr> Mul<Dim<Dr, Vr>> for Dim<Dl, Vl> where Dl: Dimension + Mul<Dr>, Dr: Dimension, Vl: Mul<Vr>, Dl::Output: Dimension
Multiplying!
impl<D, V, RHS> Mul<RHS> for Dim<D, V> where D: Dimension, V: Mul<RHS>, RHS: NotDim
Scalar multiplication (with scalar on RHS)!
impl<Dl, Dr, Vl, Vr> Div<Dim<Dr, Vr>> for Dim<Dl, Vl> where Dl: Dimension + Div<Dr>, Dr: Dimension, Vl: Div<Vr>, Dl::Output: Dimension
Dividing!
type Output = Dim<Dl::Output, Vl::Output>
fn div(self, rhs: Dim<Dr, Vr>) -> Dim<Dl::Output, Vl::Output>
impl<D, V, RHS> Div<RHS> for Dim<D, V> where D: Dimension, V: Div<RHS>, RHS: NotDim
Scalar division (with scalar on RHS)!