macro_rules! kwh {
($($literal:tt)+) => { ... };
}Expand description
An energy literal in kilowatt-hours, exact and checked at compile time: kwh!(30) is
108 000 000 watt-seconds, kwh!(1.5) 1 500 Wh.
use flexibility::{kwh, Energy};
assert_eq!(kwh!(1.5), Energy::from_watt_seconds(5_400_000));
assert_eq!(kwh!(30).to_string(), "30 kWh");ⓘ
let _ = flexibility::kwh!(1.0001);