Units.Dynamic
module Units.Dynamic
Runtime dimensional quantities. Unit dimensions use nominal Type identities, and all arithmetic composes the same normalized exponent maps.
unit
unit(scale: Float, dimension: Dimension, notation: String) -> Result<DynamicUnit, UnitError>
Define a positive, finite scale to the dimension's canonical unit.
measure
measure(value: Float, unit: DynamicUnit) -> DynamicMeasure
Build a quantity in its preferred display unit.
record DynamicUnit
Fields
Functions
*
*(other: DynamicUnit) -> Result<DynamicUnit, UnitError>
Preserve grouping in display expressions as well as dimensions and scale.
/
/(other: DynamicUnit) -> Result<DynamicUnit, UnitError>
pow
pow(exponent: Integer) -> Result<DynamicUnit, UnitError>
named
named(notation: String) -> DynamicUnit
record DynamicMeasure
Fields
canonicalFloatunitDynamicUnit
Functions
convertTo
convertTo(target: DynamicUnit) -> Result<DynamicMeasure, UnitError>
+
+(other: DynamicMeasure) -> Result<DynamicMeasure, UnitError>
-
-(other: DynamicMeasure) -> Result<DynamicMeasure, UnitError>
*
*(other: DynamicMeasure) -> Result<DynamicMeasure, UnitError>
/
/(other: DynamicMeasure) -> Result<DynamicMeasure, UnitError>
pow
pow(exponent: Integer) -> Result<DynamicMeasure, UnitError>
scale
scale(factor: Float) -> DynamicMeasure
compareTo
compareTo(other: DynamicMeasure) -> Result<Ordering, UnitError>
Ordering ignores display preferences but requires compatible dimensions.
type UnitError
Variants
InvalidScale(Float)ScaleOverflowDimensionMismatch(Dimension, Dimension)