Expand description
Derive Macros§
- AsRef
Str - Converts enum variants to
&'a str
, where'a
is the lifetime of the input enum reference. - Display
- Converts enum variants to strings.
- Enum
Count - Add a constant
usize
equal to the number of variants. - Enum
Discriminants - Generate a new type with only the discriminant names.
- EnumIs
- Generated
is_*()
methods for each variant. E.g.Color.is_red()
. - Enum
Iter - Creates a new type that iterates of the variants of an enum.
- Enum
Message - Add a verbose message to an enum variant.
- Enum
Property - Add custom properties to enum variants.
- Enum
String - Converts strings to enum variants based on their name.
- Enum
TryAs - Generated
try_as_*()
methods for all tuple-style variants. E.g.Message.try_as_write()
. - From
Repr - Add a function to enum that allows accessing variants by its discriminant
- Into
Static Str - Implements
From<MyEnum> for &'static str
on an enum. - Variant
Array - Adds a
'static
slice with all of the Enum’s variants. - Variant
Names - Implements
Strum::VariantNames
which adds an associated constantVARIANTS
which is a'static
slice of discriminant names.