Skip to content

Commit 40652b6

Browse files
authored
Add note about struct-style enum variants in pattern matching (#2784)
Can't forget to demonstrate struct-style enum variants when talking about pattern matching.
1 parent f51f0db commit 40652b6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/pattern-matching/destructuring-enums.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,8 @@ arm, `half` is bound to the value inside the `Ok` variant. In the second arm,
4747
matched.
4848
- Demonstrate what happens when the search is inexhaustive. Note the advantage
4949
the Rust compiler provides by confirming when all cases are handled.
50+
- Demonstrate the syntax for a struct-style variant by adding one to the enum
51+
definition and the `match`. Point out how this is syntactically similar to
52+
matching on a struct.
5053

5154
</details>

0 commit comments

Comments
 (0)