Function show_notes::e003::demonstrate_match
source · pub fn demonstrate_match()
Expand description
Shows in a bit more detail how match
works.
Note that the pattern matches include matching against numbers, tuple types, and more. Big takeaways:
- You can match against all sorts of types.
- You have to match exhaustively. Handle “everything else” with
_
as the sole component of the match arm. - You can destructure complex types into their components. You can ignore
components of complex types with
_
as well.