illicitonion / num_enum

Apache License 2.0
264 stars 34 forks source link

UnsafeFromPrimitive ignores default/alternatives #112

Closed illicitonion closed 1 year ago

illicitonion commented 1 year ago

Previously it would fail to derive, but there are valid use-cases for wanting to perform the unsafe conversion for known "natural" values.

This potentially opens up a bit of confusion around what the behaviours are when these attributes are present but ignored, but these are also documented, and if someone is reaching for this unsafe function rather than using {,Try}FromPrimitive or just an as cast, presumably they're paying attention...

Fixes #32

illicitonion commented 1 year ago

I'm not sure this is a positive change, but am open to discussion...