danwi 0.4.2

Zero-cost dimensional analysis library with SI units, compile-time checking, and no_std support
Documentation
use danwi::prelude::*;

fn main() {
    let ambient = 21.5.celsius();
    assert_eq!(ambient.to(K), 294.65);
    println!("{} = {}", ambient.display_as(degC), ambient.display_as(K));

    let cpu = 350.0.K();
    println!("cpu: {:.2}", cpu.display_as(degC)); // cpu: 76.85 °C

    let limit = 85.0.celsius();
    assert!(cpu < limit);

    // Quantities are stored in kelvin, so a difference is a plain interval;
    // read it in K, not °C (a °C reading would re-apply the 273.15 offset).
    let headroom = limit - cpu;
    println!("headroom: {:.2}", headroom.display_as(K)); // headroom: 8.15 K

    let setpoint = Kelvin::new(20.0, degC);
    assert_eq!(setpoint, 20.0.celsius());
}