strum

Rust procedural macro library for adding useful derive macros to enum types. Provides #[derive(Display, EnumString, EnumIter, EnumCount, EnumVariantNames, EnumMessage, IntoStaticStr, AsRefStr, EnumIs)] and more. Makes Rust enums easy to convert to/from strings, iterate over variants, count variants, and attach messages. Particularly useful for configuration systems, CLI argument parsing, and domain type modeling.

Evaluated Mar 07, 2026 (0d ago) v0.26+
Homepage ↗ Repo ↗ Developer Tools rust enum derive macros string-conversion iterator display fromstr
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
99
/ 100
Is it safe for agents?
⚡ Reliability
87
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
85
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
92
Secret Handling
100

Compile-time macro library. No runtime security surface.

⚡ Reliability

Uptime/SLA
92
Version Stability
85
Breaking Changes
82
Error Recovery
90
AF Security Reliability

Best When

You need ergonomic string conversion, iteration, or metadata for Rust enums — strum adds the missing standard library enum capabilities.

Avoid When

You need JSON/YAML serialization with custom representations (use serde) or have complex enum variants with data requiring custom Display logic.

Use Cases

  • Convert Rust enum variants to/from strings for configuration files, CLI arguments, and API serialization with #[derive(EnumString, Display)]
  • Iterate over all variants of a Rust enum with #[derive(EnumIter)] for generating menus, help text, or exhaustive testing
  • Attach string messages or documentation to enum variants with #[strum(message)] for user-facing display
  • Build configuration systems where string-to-enum conversion is needed for YAML/TOML config parsing with strum's case-insensitive matching
  • Generate variant names as &'static str for logging and metrics labels without runtime allocation

Not For

  • Complex serialization requirements — use serde for JSON/YAML serialization with custom enum representations
  • Enums with associated data needing Display — strum's Display works best for unit variants; use manual impl for complex data
  • Non-enum types — strum targets enums specifically; use derive_more for struct-level derive macros

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Compile-time macro library. No runtime, no authentication.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT license.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • EnumString matching is case-sensitive by default — use #[strum(ascii_case_insensitive)] for case-insensitive parsing from config files or user input
  • Display output uses the variant name by default — use #[strum(to_string = "custom")] or #[strum(serialize = "alt")] for custom string representations
  • EnumIter creates a separate Iter struct — importing MyEnumIter and calling IntoEnumIterator::iter() requires the IntoEnumIterator trait in scope
  • Variants with associated data (tuple variants, struct variants) may not support all strum derives — check which derives work with data-carrying variants
  • strum and strum_macros are separate crates — must add both as dependencies; strum_macros provides the proc-macros, strum provides the traits
  • Rename attributes in strum and serde can conflict — when using both, strum #[strum(serialize)] and serde #[serde(rename)] apply independently

Alternatives

Full Evaluation Report

Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for strum.

AI-powered analysis · PDF + markdown · Delivered within 30 minutes

$99

Package Brief

Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.

Delivered within 10 minutes

$3

Score Monitoring

Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.

Continuous monitoring

$3/mo

Scores are editorial opinions as of 2026-03-07.

6228
Packages Evaluated
26150
Need Evaluation
173
Need Re-evaluation
Community Powered