Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Register handling more elegant #1

Open
mre opened this issue Jun 11, 2016 · 0 comments
Open

Make Register handling more elegant #1

mre opened this issue Jun 11, 2016 · 0 comments

Comments

@mre
Copy link
Owner

mre commented Jun 11, 2016

It might be possible to use ToString to get a register name instead of the RegisterId weirdness that I'm currently using.

Inspired by https://github.com/benashford/rs-es/blob/master/src/units.rs#L315-L329:

impl ToString for DistanceUnit {
    fn to_string(&self) -> String {
        match *self {
            DistanceUnit::Mile => "mi",
            DistanceUnit::Yard => "yd",
            DistanceUnit::Feet => "ft",
            DistanceUnit::Inch => "in",
            DistanceUnit::Kilometer => "km",
            DistanceUnit::Meter => "m",
            DistanceUnit::Centimeter => "cm",
            DistanceUnit::Millimeter => "mm",
            DistanceUnit::NauticalMile => "NM"
        }.to_owned()
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant