-
Notifications
You must be signed in to change notification settings - Fork 34
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 incorrectly uses default attribute #75
Comments
The issue is that there is documented in the readme |
Sorry for the super slow response here - yes, I agree that |
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
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
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
As the awaited issue in `num_enum` crate (illicitonion/num_enum#75) has been resolved in its 0.6 release, it is now possible to derive Default for Consistency automatically.
If we have an enum where a
#[default]
is applied for another derive,TryFromPrimitive
becomes useless, and will silently return the default. This is both undocumented, and makes no sense - surely the point ofTryFromPrimitive
is to test the input is valid. If the default is required,FromPrimitive
has this behaviour documented.Closely related to #31, however the fix there cannot be applied, because the attribute is actually required for another macro.
The text was updated successfully, but these errors were encountered: