Crate strum_macros
source · [−]Expand description
Strum
Strum is a set of macros and traits for working with enums and strings easier in Rust.
Derive Macros
Converts enum variants to &'static str
.
Converts enum variants to strings.
Add a constant usize
equal to the number of variants.
Generate a new type with only the discriminant names.
Creates a new type that iterates of the variants of an enum.
Add a verbose message to an enum variant.
Add custom properties to enum variants.
Converts strings to enum variants based on their name.
Implements Strum::VariantNames
which adds an associated constant VARIANTS
which is an array of discriminant names.
Add a function to enum that allows accessing variants by its discriminant.
On Rust 1.34 and above, std::convert::TryFrom
Implements From<MyEnum> for &'static str
on an enum.
implements std::string::ToString
on en enum