Function variant_count
const fn variant_count<T>() -> usize
Returns the number of variants in the enum type T.
If T is not an enum, calling this function will not result in undefined behavior, but the
return value is unspecified. Equally, if T is an enum with more variants than usize::MAX
the return value is unspecified. Uninhabited variants will be counted.
Note that an enum may be expanded with additional variants in the future
as a non-breaking change, for example if it is marked #[non_exhaustive],
which will change the result of this function.
Examples
#
#
use mem;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;