iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't parse units added to existing quantities

Netzwerk2 opened this issue · comments

Units which are added to existing quantities fail to parse.
Minimal example:

#[macro_use]
extern crate uom;

use std::str::FromStr;

use uom::si::f64::Length;

unit! {
    system: uom::si;
    quantity: uom::si::length;

    @smoot: 1.702; "smoot", "smoot", "smoots";
}

fn main() {
    dbg!(Length::from_str("1 smoot").unwrap());
}

Macro to implement a set of measurement units. Note that units manually defined using this macro will not be included in the quantity unit enum or associated functions, or in the FromStr implementation.

Found out that this is already mentioned in the unit macro docs.