macro_rules! ISQ { ($path:path) => { ... }; ($path:path, $V:ty) => { ... }; ($path:path, $V:ty, $U:tt) => { ... }; }
Expand description
Macro to implement quantity type aliases for a specific
system of units and value storage type.
$system: Path to the module where thesystem!macro was run (e.g.uom::si).$V: Underlying value storage type (e.g.f32).$U: Optional. Base units. Pass as a tuple with the desired units: (e.g.(meter, kilogram, second, ampere, kelvin, mole, candela)). The system’s base units will be used if no value is provided. When a value is provided a new trait type alias,Units, is defined. Note that a unit with a non-zero constant factor is not currently supported as a base unit.
An example invocation is given below for a meter-kilogram-second system setup in the
module mks with a system of quantities name Q. The #[macro_use] attribute must be
used when including the uom crate to make macros for predefined systems available.
The optional units parameter to change the base units is included commented out.
#[macro_use]
extern crate uom;
mod f32 {
Q!(crate::mks, f32/*, (centimeter, gram, second)*/);
}