I would like to see the following work:
let d = Distance::from_metres(100);
println!("{}", d.as_imperial()); // gives 109 yards, 1'1"
Will require fn as_imperial(&'a self) -> DistanceImperial<'a>
, where DistanceImperial just holds a reference to the parent, and impl's Display. You could also have a metric version as_metric()
which only gives one unit, but selects the appropriate SI scale (e.g. 33.3km, 33.3m, 33.3cm, 33.3mm, 33.3μm, etc).