.. /index

strum

strum

strum is the single most popular Rust enum ergonomics crate, with 100M+ all-time downloads. It provides derive macros that cover the most common enum boilerplate: Display, FromStr, iteration, counting, metadata, discriminant extraction, and integer conversion — what would otherwise require five separate dependencies.

Key derives

When to use strum

strum is the default choice when you need any combination of enum-to-string, string-to-enum, or variant iteration. For error types specifically, thiserror or snafu are better fits. For broader trait derivation beyond enums (From, Into, operators), derive-more covers more ground. For bitflag-style enums, bitflags is the standard.

enum-iterator offers a richer iteration API than strum's EnumIter (cyclic navigation, next()/previous(), works on composite types), but strum's bundled approach is usually sufficient. strum-lite provides a lighter alternative using declarative macros for faster compilation.

See rust-enum-crates for the full landscape.

Linked from

Sources