Skip to content

Add 'as_imperial()' function / type for nice formatting. #2

@thejpster

Description

@thejpster

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions