juniorRust

What are enums in Rust?

Updated May 24, 2026

Short answer

Enums define a type that can be one of several variants.

Deep explanation

Rust enums are powerful and can store data in each variant, enabling expressive modeling like Option and Result types.

Real-world example

HTTP response states, error handling.

Common mistakes

  • Not handling all enum variants in match expressions.

Follow-up questions

  • What is Option enum?
  • Why are enums powerful in Rust?

More Rust interview questions

View all →