#[repr(transparent)]pub struct Quantity<T, U: Unit> { /* private fields */ }Expand description
A physical quantity with a defined unit.
Implementations§
source§impl<T, U: Unit> Quantity<T, U>
impl<T, U: Unit> Quantity<T, U>
sourcepub fn convert<Y: UnitConvert<T, U>>(self) -> Quantity<T, Y>
pub fn convert<Y: UnitConvert<T, U>>(self) -> Quantity<T, Y>
Convert between quantities with different units or the same units with different scales.
let a: Quantity<i32, si::m> = Quantity::new(3);
let b: Quantity<i32, si::milli<si::m>> = a.convert();
assert_eq!(*b, 3000);Trait Implementations§
source§impl<T, U1, U2: Unit> Div<Quantity<T, U2>> for Quantity<T, U1>where
T: Div<Output = T>,
U1: Div<U2> + Unit,
<U1 as Div<U2>>::Output: Unit,
impl<T, U1, U2: Unit> Div<Quantity<T, U2>> for Quantity<T, U1>where T: Div<Output = T>, U1: Div<U2> + Unit, <U1 as Div<U2>>::Output: Unit,
source§impl<T, U1, U2: Unit> Mul<Quantity<T, U2>> for Quantity<T, U1>where
T: Mul<Output = T>,
U1: Mul<U2> + Unit,
<U1 as Mul<U2>>::Output: Unit,
impl<T, U1, U2: Unit> Mul<Quantity<T, U2>> for Quantity<T, U1>where T: Mul<Output = T>, U1: Mul<U2> + Unit, <U1 as Mul<U2>>::Output: Unit,
source§impl<T: Ord, U: Unit> Ord for Quantity<T, U>
impl<T: Ord, U: Unit> Ord for Quantity<T, U>
source§impl<T: PartialEq, U: Unit> PartialEq<Quantity<T, U>> for Quantity<T, U>
impl<T: PartialEq, U: Unit> PartialEq<Quantity<T, U>> for Quantity<T, U>
source§impl<T: PartialOrd, U: Unit> PartialOrd<Quantity<T, U>> for Quantity<T, U>
impl<T: PartialOrd, U: Unit> PartialOrd<Quantity<T, U>> for Quantity<T, U>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<T: Copy, U: Unit> Copy for Quantity<T, U>
impl<T: Eq, U: Unit> Eq for Quantity<T, U>
Auto Trait Implementations§
impl<T, U> RefUnwindSafe for Quantity<T, U>where T: RefUnwindSafe, U: RefUnwindSafe,
impl<T, U> Send for Quantity<T, U>where T: Send, U: Send,
impl<T, U> Sync for Quantity<T, U>where T: Sync, U: Sync,
impl<T, U> Unpin for Quantity<T, U>where T: Unpin, U: Unpin,
impl<T, U> UnwindSafe for Quantity<T, U>where T: UnwindSafe, U: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more