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
Made edition an enum again #185
Conversation
This should be ready to merge but it would be a good idea to add some tests against all the enum variants. Right now only edition 2018 is tested. That ought to be enough but one can never be too sure. I'd love @oli-obk opinion on the tests as I'm a bit confused as how they are organized what the best way to test them would be. |
As I mentioned in #183, I'm afraid this has fundamental issues as explained in https://sunshowers.io/posts/open-closed-universes/#a-pattern-to-avoid-unknown-or-other-variants |
As highlighted by @sunshowers in #183 and their blog post this may have caused some issue when comparing existing values so I manually Implemented Eq/PartialEq/Hash so that cases like: Edition::E2018 == Edition::Unknown("2018") produce the correct value |
I think it would be better if |
I reverted back to the original implementation while also including editions up to 2030. I think 8 years should be more that enough considering that by that time the concept of editions might not even be relevant anymore. |
Lgtm, i'll wait for @sunshowers to chime in before merging though |
Looks good to me, thanks for this! |
As mentioned in #183 this makes the Edition an enum again but also future proofs it by adding an
Unknown
variant