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

TryFromPrimitive ignores default attributes #110

Merged
merged 2 commits into from Mar 18, 2023
Merged

TryFromPrimitive ignores default attributes #110

merged 2 commits into from Mar 18, 2023

Conversation

illicitonion
Copy link
Owner

If exhaustive behaviour is desired, FromPrimitive should be derived
instead.

Because these traits are exclusive, there's no room for ambiguity here -
either TryFromPrimitive is derived and defaults are ignored, or
FromPrimitive is derived and defaults are paid attention to.

This is, however, a breaking change, as it changes the implementation of
TryFromPrimitive significantly.

Fixes #75
Fixes #31

If exhaustive behaviour is desired, FromPrimitive should be derived
instead.

Because these traits are exclusive, there's no room for ambiguity here -
either TryFromPrimitive is derived and defaults are ignored, or
FromPrimitive is derived and defaults are paid attention to.

This is, however, a breaking change, as it changes the implementation of
TryFromPrimitive significantly.

Fixes #75
Fixes #31
This isn't necessarily ready for release, but we're making a breaking
change so we should bump so we don't forget whenever the time for the
next release comes.
Copy link
Collaborator

@danielhenrymantilla danielhenrymantilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@illicitonion illicitonion merged commit c90528c into main Mar 18, 2023
@illicitonion illicitonion deleted the default branch March 18, 2023 19:46
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.

TryFromPrimitive incorrectly uses default attribute Why default on TryFromPrimitive ?
2 participants