[][src]Macro uom::ISQ

macro_rules! ISQ {
    ($path:path) => { ... };
    ($path:path, $V:ty) => { ... };
    ($path:path, $V:ty, $U:tt) => { ... };
}

Macro to implement quantity type aliases for a specific system of units and value storage type.

  • $path: Path to the module where the system! 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: (meter, kilogram, second, ampere, kelvin, mole, candela). The system's base units will be used if no value is provided. 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 {
    mod mks {
        pub use super::super::*;
    }

    // `crate::mks` works in Rust 1.30.0 or later. `mod mks {...}` workaround is needed
    // to support older versions of Rust and the 2018 edition at the same time.
    Q!(self::mks, f32/*, (centimeter, gram, second)*/);
}