illicitonion / num_enum

Apache License 2.0
264 stars 34 forks source link

TryFromPrimitive ignores default attributes #110

Closed illicitonion closed 1 year ago

illicitonion commented 1 year ago

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 https://github.com/illicitonion/num_enum/issues/75 Fixes https://github.com/illicitonion/num_enum/issues/31