1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-07-03 05:27:04 +02:00

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.
This commit is contained in:
Nicole L
2025-06-26 12:01:04 -07:00
committed by GitHub
parent f51f0dbb13
commit 40652b6415

View File

@ -47,5 +47,8 @@ arm, `half` is bound to the value inside the `Ok` variant. In the second arm,
matched.
- Demonstrate what happens when the search is inexhaustive. Note the advantage
the Rust compiler provides by confirming when all cases are handled.
- Demonstrate the syntax for a struct-style variant by adding one to the enum
definition and the `match`. Point out how this is syntactically similar to
matching on a struct.
</details>