[Verse 1]
In Rust we build our custom types with enum declarations
Like colors red and green and blue, or card suit variations
Each variant stands alone and proud, distinct from all the rest
No mixing up our data types, enum keeps things organized best
[Chorus]
Match it up, match it down
Pattern matching all around
Every case must be covered now
Rust won't let you miss somehow
Match it up, match it down
Safest code that can be found
[Verse 2]
Some variants hold data too, like Option with Some and None
Result gives Ok or Error state, until your task is done
You define them with the enum word, then list each variant name
With data types in parentheses, they're not all quite the same
[Chorus]
Match it up, match it down
Pattern matching all around
Every case must be covered now
Rust won't let you miss somehow
Match it up, match it down
Safest code that can be found
[Verse 3]
When you want to use your enum, match expression is the key
Check every single variant, exhaustively you see
With arrow pointing to the right, you handle every case
If you forget just one of them, compile error shows its face
[Chorus]
Match it up, match it down
Pattern matching all around
Every case must be covered now
Rust won't let you miss somehow
Match it up, match it down
Safest code that can be found
[Bridge]
Underscore catches everything else that you might miss
Destructure data from inside, extract with gentle bliss
Guards can add conditions too, with if upon the line
Pattern matching keeps you safe, your code will work just fine
[Outro]
Enums group related states
Pattern matching never waits
Every path is crystal clear
No runtime crashes you need fear