si

Creates a function that parses a string for a SI unit or quantity at compile-time.

alias si = ctQuantityParser!(double, _siSymbolList, std.conv.parse!(double, string))

Examples

enum min = si!"min";
enum inch = si!"2.54 cm";

auto conc = si!"1 µmol/L";
auto speed = si!"m s^-1";
auto value = si!"0.5";

static assert(is(typeof(conc) == Concentration));
static assert(is(typeof(speed) == Speed));
static assert(is(typeof(value) == Dimensionless));

Meta