Struct friendly::quantity::Quantity [−][src]
pub struct Quantity<Q: QVal, F: PrefixFamily> { /* fields omitted */ }
Expand description
A numeric quantity to display.
Quantity
is the core type for general display of numeric quantities that may
be rescaled with prefixes, may have unit suffixes, etc.
By default, quantities are displayed with 4 significant figures and are auto-scaled. Individual convenience functions may provide different defaults.
Implementations
Configure this quantity with a different scale.
The use of Into
bounds allows this to rescale with either a fixed scale:
let q = Quantity::decimal(10324); let q = q.scale(Decimal::KILO); assert_eq!(q.to_string().as_str(), "10.32 k");
Or auto-scaling:
let q = Quantity::decimal(10324); let q = q.scale(Decimal::AUTO); assert_eq!(q.to_string().as_str(), "10.32 k");
Trait Implementations
Auto Trait Implementations
impl<Q, F> RefUnwindSafe for Quantity<Q, F> where
Q: RefUnwindSafe,
<F as PrefixFamily>::Prefix: RefUnwindSafe,
impl<Q, F> UnwindSafe for Quantity<Q, F> where
Q: UnwindSafe,
<F as PrefixFamily>::Prefix: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more