1 unstable release
Uses new Rust 2024
| 0.0.0-reserved | Dec 14, 2025 |
|---|
#6 in #variant-count
46KB
816 lines
enumwow
Differences from strum
Creating a second crate allows us to re-think the entire API, and we did:
FromStrDisplayVARIANT_COUNTadds associated constantVARIANT_COUNTVARIANT_NAMESadds associated constantVARIANT_NAMESEnumKind, creates a same enum without any fieldsEnumIter, creates an iterator over the enum's variants (fields areDefaulted)from_discriminantdiscriminantvariant_name, a function of signaturefn(&self) -> &'static strisfor each variant, returnsboolas, get the exact variant as anOptionmap, get the exact variant in a closureunwrapexpect
wowenum
EnumStringrenamed toFromStr- Generics are not supported, due of fundamental language limitations
in Rust's
macro_rules!macros - No traits. The fact that
strumrequires importing its special traits makes the APIs harder to use, and I've yet to see a single library that actually was generic over any ofstrum's traits, so instead we add the respective items as associated constants/functions
Dependencies
~520KB