Open jchidley opened 8 months ago
Thanks for all the great positive feedback and explicit examples of issues!
A few of these already have issue:
A bit more feedback about the rest would be great:
ThermodynamicTemperature
vs. TemperatureInterval
?uom::si::f32::Power
? Is the need to reference the underlying type confusing? There is a type alias at uom::si::power::Power
, but this is even less friendly to use.
I wanted to confirm what the power loss would be for a mechanical heat recovery fan. I had tried to do this on a calculator but this quickly became annoying: the need to check units, do unit conversions (all scalar!), revise calculations etc.
So I thought that I'd try to use
rust
to do the same thing. I quickly found theuom
library and entered the following program:The initial implementation of main ended with line 36:
println!("{hv:?}");
with this output68.62647 m^2 kg^1 s^-3
Because I'm a science/engineering graduate, I recognised the output as base SI units (I knew that 68 was about right) and so looked up the definition of "watt" to confirm that it was correct.
The fact that I was able write this quickly in
rust
, including using the original Greek letters, and get the output in properly typed SI units is amazing. This illustrates to me why it's worth investing inrust
and how great theuom
library is.There were a number of things that tripped me up and took me a long time deal with:
uom
library for the SI quantity "litre"ThermodynamicTemperature
vsTemperatureInterval
println
output of "m^2 kg^1 s^-3" base units to "watts" derived unit in "proper"println
outputSpecificHeatCapacity
asQuantitly<dyn Dimension<L = ...
etcPower
as the type annotation (fromuom::si::f32
and not somewhere else). It's difficult to write functions without this.println!("{}", s.with(hv));
indoesnt_work
function and then try uncommentingprintln!("{}", hv.into_format_args(second, Description));
instead. See below for the compiler output of each, below.