Closed jchidley closed 6 months ago
So, of course, I found the answer in the unit.rs
example a few minutes after I posted my question.
Once I had added this two lines at the top:
use uom::fmt::DisplayStyle::Description;
use uom::si::power::watt;
I could print using this statement:
println!("{}", hv.into_format_args(watt, Description));
I have this function:
This prints an answer in these units:
m^2 kg^1 s^-3
or, as I normally think about it, watts.I can't figure out, for the life of me, how to get the answer into actual watts in
uom
(or even what the correctwatts
is). I can see that uom a really comprehensive and useful library but, as a newbie to rust and the library, it is daunting with a few examples and no tutorial.This doesn't work:
Which tells me that I am doing the conversion wrongly.