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: a meter reading is evidence for an invoice, and
0.1 + 0.2 must not be a billing question. Display prints the exact
decimal, e.g. 12345.6 Wh.
Fields§
§mantissa: i128The raw value from the meter.
exponent: i8The scaler from the meter (SML_ListEntry.scaler), 0 when absent.
unit: Option<Unit>The unit, when the meter sent one.
Implementations§
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