-
Notifications
You must be signed in to change notification settings - Fork 149
Derive ToPrimitive for enums #314
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
Conversation
Failure unrelated to this PR, it's instead due to rust-lang/rust#42431 |
That failure is also #312. Simple enums can be cast directly to integers with |
@cuviper Oh I had no idea! I'll change the implementation. |
|
Hmm, that's awkward. Such enums should be trivially copyable.
|
Should be, but we can't guarantee they implement Yeah, it's awkward. |
I don't think it's quite that hygienic -- at least from a quick test, deriving with bors r+ |
@cuviper I didn't check that, but trying to use the |
Build succeeded |
That's ok. What you wrote works, most importantly. Thanks! |
I had to double the compile fail tests, as they will bail on the first error.
I have some ideas for more complex to/from primitive derives (with inner values that implement to/from primitive), but I'll save those for a future PR.