pub struct Quantity {
pub mantissa: i128,
pub exponent: i8,
pub unit: Option<Unit>,
}Expand description
An exact measured quantity: mantissa × 10^exponent in unit. Never a float.
Fields§
§mantissa: i128The raw value from the meter.
exponent: i8The decimal exponent from the VIF.
unit: Option<Unit>The unit.
Implementations§
Source§impl Quantity
impl Quantity
Sourcepub fn round(self, exponent: i8) -> Option<Self>
pub fn round(self, exponent: i8) -> Option<Self>
Round to units of 10^exponent, half to even: an explicit, visible rounding for
display or for a coarser register. Exact (no rounding) when exponent is not
coarser than the quantity’s. None on overflow.
Sourcepub fn significant(self, digits: u32) -> Option<Self>
pub fn significant(self, digits: u32) -> Option<Self>
Rounded to at most digits significant digits (never more precise than it is).
Trait Implementations§
impl Copy for Quantity
impl Eq for Quantity
impl StructuralPartialEq for Quantity
Auto Trait Implementations§
impl Forget for Quantity
impl Freeze for Quantity
impl Move for Quantity
impl RefUnwindSafe for Quantity
impl Send for Quantity
impl Sync for Quantity
impl Unpin for Quantity
impl UnsafeUnpin for Quantity
impl UnwindSafe for Quantity
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