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

Add TryFrom conversions for integer types #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cfrantz
Copy link

@cfrantz cfrantz commented Mar 10, 2023

When primitive_conversions is specified as an option to the
open_enum macro, TryFrom conversions will be implemented to
facilitate conversions between all integer types.

Signed-off-by: Chris Frantz [email protected]

Add `From` implementations that convert between the integer
representation and the enum representation.

Signed-off-by: Chris Frantz <[email protected]>
When `primitive_conversions` is specified as an option to the
`open_enum` macro, `TryFrom` conversions will be implemented to
facilitate conversions between all integer types.

Signed-off-by: Chris Frantz <[email protected]>
@kupiakos
Copy link
Owner

Can you instead create TryFromPrimitive and TryIntoPrimitive derive macros rather than having this be controlled by the open_enum attribute itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants