Struct physical_quantity::unit::Unit
source · [−]pub struct Unit<R, D> {
pub a: R,
pub b: R,
pub dim: D,
}
Expand description
Representation of Unit
Holding the coefficients for converting to the base unit and dimension.
Fields
a: R
b: R
dim: D
Implementations
sourceimpl<R, D> Unit<R, D> where
D: Dimension,
R: Real,
impl<R, D> Unit<R, D> where
D: Dimension,
R: Real,
sourcepub fn pq(&self, r: R) -> PhysicalQuantity<R, D>
pub fn pq(&self, r: R) -> PhysicalQuantity<R, D>
let pq = "m".parse::<Unit<_, _>>().unwrap().pq(2.0);
assert_eq!(pq, PhysicalQuantity {
value: 2.0,
dim: Length::new(),
});
Trait Implementations
sourceimpl<'a, D0, D1, R> Div<&'a Unit<R, D1>> for Unit<R, D0> where
PhysicalQuantity<R, D0>: Div<PhysicalQuantity<R, D1>>,
D0: Dimension + Div<D1>,
<D0 as Div<D1>>::Output: Dimension,
D1: Dimension,
R: Real,
impl<'a, D0, D1, R> Div<&'a Unit<R, D1>> for Unit<R, D0> where
PhysicalQuantity<R, D0>: Div<PhysicalQuantity<R, D1>>,
D0: Dimension + Div<D1>,
<D0 as Div<D1>>::Output: Dimension,
D1: Dimension,
R: Real,
sourceimpl<R> FromStr for Unit<R, DynDim> where
R: Real,
impl<R> FromStr for Unit<R, DynDim> where
R: Real,
Runtime parsing for unit string by using default unit definition.
For the syntax of unit strring, see Parser documentation.
For the default unit definition, see DEFAULT_UNIT_DEF documentation.
sourceimpl<'a, D0, D1, R> Mul<&'a Unit<R, D1>> for Unit<R, D0> where
PhysicalQuantity<R, D0>: Mul<PhysicalQuantity<R, D1>>,
D0: Dimension + Mul<D1>,
<D0 as Mul<D1>>::Output: Dimension,
D1: Dimension,
R: Real,
impl<'a, D0, D1, R> Mul<&'a Unit<R, D1>> for Unit<R, D0> where
PhysicalQuantity<R, D0>: Mul<PhysicalQuantity<R, D1>>,
D0: Dimension + Mul<D1>,
<D0 as Mul<D1>>::Output: Dimension,
D1: Dimension,
R: Real,
sourceimpl<D0, D1, R> PartialEq<Unit<R, D1>> for Unit<R, D0> where
D0: Dimension,
D1: Dimension,
R: Real,
PhysicalQuantity<R, D0>: PartialEq<PhysicalQuantity<R, D1>>,
impl<D0, D1, R> PartialEq<Unit<R, D1>> for Unit<R, D0> where
D0: Dimension,
D1: Dimension,
R: Real,
PhysicalQuantity<R, D0>: PartialEq<PhysicalQuantity<R, D1>>,
impl<R, D> Copy for Unit<R, D> where
R: Copy,
D: Copy,
Auto Trait Implementations
impl<R, D> RefUnwindSafe for Unit<R, D> where
D: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, D> Send for Unit<R, D> where
D: Send,
R: Send,
impl<R, D> Sync for Unit<R, D> where
D: Sync,
R: Sync,
impl<R, D> Unpin for Unit<R, D> where
D: Unpin,
R: Unpin,
impl<R, D> UnwindSafe for Unit<R, D> where
D: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more