You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
Selecting of SI scales now happens through get_appropriate_units. I'm still interested in as_imperial though, which would select an appropriate imperial unit (or collection of imperial units, e.g. 14 miles, 1200 yards, 3', 2¼")
I would like to see the following work:
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 versionas_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).The text was updated successfully, but these errors were encountered: