danwi 0.4.2

Zero-cost dimensional analysis library with SI units, compile-time checking, and no_std support
Documentation
mod imperial {
    use danwi::dimension::{Length, Mass};

    danwi::units! {
        foot: Length { symbol: ft, scale: 3_048 / 10_000 },
        mile: Length { symbol: mi, scale: 1_609_344 / 1_000 },
        pound: Mass { symbol: lb, scale: 45_359_237 / 100_000_000 },
    }
}

use danwi::prelude::*;
use imperial::{constants::*, ext::F64QuantityExt as _};

fn main() {
    assert_eq!(1.0.mile(), 5280.0.foot());

    let marathon = 26.2.mile();
    println!("{:.1}", marathon.display_as(km)); // 42.2 km
    println!("{:.0}", marathon.display_as(ft)); // 138336 ft

    let weight = 150.0.pound();
    println!("{:.1}", weight.display_as(kg)); // 68.0 kg
    println!("{:.1}", weight.display_as(lb)); // 150.0 lb
}