Anonymous Enums
Enum types with fully-generic variants.
This library defines enum types which are generic over from 2 (Enum2
) to 16 (Enum16
) type parameters.
Each type parameter of a given enum type is the type of the single field of its respective variant of the same name
(all variants are tuple structs with a single field).
use HashMap;
use Enum2;
/// Error type stating that a map does not contain a given key.
;
/// Error type stating that an integer overflow occured during
/// an arithmetic operation.
;
/// Maps a `str` to an integer of type `i32` and returns the integer plus one.
An enum of more than 16 variants may be expressed by setting
the generic type T15
of Enum16
to an enum type:
// Enum of 18 variants.
.., T14, >