uom
uom copied to clipboard
Types for new combined quantities are really difficult to write
I had to store the molar gas constant in a place where I had to write the type of the variable for Rust. The SI unit is "joule per kelvin per mole". Heat capacity is "joule per kelvin" and molar energy is "joule per mole", so neither will do directly.
What I finally came up with much trial and error was:
type HeatCapacityPerAmountOfSubstance = Quantity<ISQ<P2, P1, N2, Z0, N1, N1, Z0>, SI<f64>, f64>;
However, this is not really user friendly. Perhaps there could be a macro to help with this?
Another good suggestion. Your code snippet above is the best way currently.