pub trait VariantArray: Sized + 'static {
const VARIANTS: &'static [Self];
}
Expand description
A trait for retrieving a static array containing all the variants in an Enum.
This trait can be autoderived by strum_macros
. For derived usage, all the
variants in the enumerator need to be unit-types, which means you can’t autoderive
enums with inner data in one or more variants. Consider using it alongside
EnumDiscriminants
if you require inner data but still want to have an
static array of variants.
Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.