pub struct Measurement<T, U: Unit> { /* private fields */ }Expand description
Type-safe measurement with units
Implementations§
Source§impl<T, U: Unit> Measurement<T, U>
impl<T, U: Unit> Measurement<T, U>
Sourcepub unsafe fn convert_unit<V: Unit>(self) -> Measurement<T, V>
pub unsafe fn convert_unit<V: Unit>(self) -> Measurement<T, V>
Convert to different unit (unsafe, requires manual verification)
§Safety
The caller must ensure that the conversion between units is mathematically valid and that the value makes sense in the target unit system.
Trait Implementations§
Source§impl<T: Clone, U: Clone + Unit> Clone for Measurement<T, U>
impl<T: Clone, U: Clone + Unit> Clone for Measurement<T, U>
Source§fn clone(&self) -> Measurement<T, U>
fn clone(&self) -> Measurement<T, U>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: PartialOrd, U: PartialOrd + Unit> PartialOrd for Measurement<T, U>
impl<T: PartialOrd, U: PartialOrd + Unit> PartialOrd for Measurement<T, U>
impl<T: Copy, U: Copy + Unit> Copy for Measurement<T, U>
impl<T, U: Unit> StructuralPartialEq for Measurement<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for Measurement<T, U>where
T: Freeze,
impl<T, U> RefUnwindSafe for Measurement<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Measurement<T, U>
impl<T, U> Sync for Measurement<T, U>
impl<T, U> Unpin for Measurement<T, U>
impl<T, U> UnwindSafe for Measurement<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more