Define a “named” enum, i.e., each variant corresponds
to a string literal, with a 1-1 mapping. You get EnumType::lookup_by_name
and EnumType.get_name() for free.
Define a “u8” enum
gives you a try_from(u8) -> Option function
Define a “named” enum, i.e., each variant corresponds
to a string literal, with a 1-1 mapping. You get EnumType::lookup_by_name
and EnumType.get_name() for free.
Borrowed from Andrew Poelstra’s rust-bitcoin
Define an iterable enum: an enum where each variant is an atomic
type (i.e., has no paramters), and the variants can be iterated over
with an Enum::ALL const