Trait strum::VariantArray

source ·
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§

source

const VARIANTS: &'static [Self]

Object Safety§

This trait is not object safe.

Implementors§