pub struct Quantity<const U: i32>(pub(crate) f32);
Expand description
A quantity with associated units.
The units are either base SI units and several extensions (for example m, s, px) or derived units (for example rad, m/s⁻²). Only unit powers up to +/-7 are supported: id est m² or m⁻² are supported but m⁸ is not.
Tuple Fields§
§0: f32
Implementations§
source§impl<const U: i32> Quantity<U>
impl<const U: i32> Quantity<U>
pub const ZERO: Self = _
pub const ONE: Self = _
sourcepub const fn new_unchecked(value: f32) -> Self
pub const fn new_unchecked(value: f32) -> Self
Creates a new quantity without checking the value.
It is expected that the value is not a NaN. If NaN is given, the type might behave strangely or panic during some of the operations.
pub const fn inner(&self) -> f32
Trait Implementations§
source§impl<const U: i32> AddAssign for Quantity<U>
impl<const U: i32> AddAssign for Quantity<U>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moresource§impl<const U: i32> DivAssign<f32> for Quantity<U>
impl<const U: i32> DivAssign<f32> for Quantity<U>
source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/=
operation. Read moresource§impl<const U: i32> MulAssign<f32> for Quantity<U>
impl<const U: i32> MulAssign<f32> for Quantity<U>
source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*=
operation. Read moresource§impl<const U: i32> Ord for Quantity<U>
impl<const U: i32> Ord for Quantity<U>
source§impl<const U: i32> PartialEq for Quantity<U>
impl<const U: i32> PartialEq for Quantity<U>
source§impl<const U: i32> PartialOrd for Quantity<U>
impl<const U: i32> PartialOrd for Quantity<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 moresource§impl<const U: i32> SubAssign for Quantity<U>
impl<const U: i32> SubAssign for Quantity<U>
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read moreimpl<const U: i32> Copy for Quantity<U>
impl<const U: i32> Eq for Quantity<U>
Auto Trait Implementations§
impl<const U: i32> Freeze for Quantity<U>
impl<const U: i32> RefUnwindSafe for Quantity<U>
impl<const U: i32> Send for Quantity<U>
impl<const U: i32> Sync for Quantity<U>
impl<const U: i32> Unpin for Quantity<U>
impl<const U: i32> UnwindSafe for Quantity<U>
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