Automatically initialize enum variants by discriminant.
This crate provides the [FromDiscriminant] trait and associated derive macro
for automatically generating code to initialize enum values from their discriminant.
Basically, for fieldless, non-generic enums with a #[repr(...)] specified, the derive macro generates
the giant match block required to initialize the enum from a discriminant value as an implementation of [FromDiscriminant].
Usage
Given an enum that fits these constraints:
use FromDiscriminant;
assert_eq!;
assert_eq!;