Sure, there’s enum_primitive
using macros 1.0, and enum-primitive-derive
and num-derive
using custom derive – all targeting FromPrimitive
. I’m sure TryFrom
could be derived the same way, although automatically writing this for just the repr
type is harder, since we don’t have that type info AFAIK.