1 unstable release

Uses new Rust 2024

0.0.0-reserved Dec 14, 2025

#6 in #variant-count

MIT/Apache

46KB
816 lines

enumwow

Differences from strum

Creating a second crate allows us to re-think the entire API, and we did:

  • FromStr
  • Display
  • VARIANT_COUNT adds associated constant VARIANT_COUNT
  • VARIANT_NAMES adds associated constant VARIANT_NAMES
  • EnumKind, creates a same enum without any fields
  • EnumIter, creates an iterator over the enum's variants (fields are Defaulted)
  • from_discriminant
  • discriminant
  • variant_name, a function of signature fn(&self) -> &'static str
  • is for each variant, returns bool
  • as, get the exact variant as an Option
  • map, get the exact variant in a closure
  • unwrap
  • expect

wowenum

  • EnumString renamed to FromStr
  • Generics are not supported, due of fundamental language limitations in Rust's macro_rules! macros
  • No traits. The fact that strum requires 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 of strum's traits, so instead we add the respective items as associated constants/functions

Dependencies

~520KB