1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-02-01 22:00:09 +02:00

Update variant-payloads.md (#459)

Fix typo
This commit is contained in:
Steve Masterman 2023-02-27 08:19:32 -05:00 committed by GitHub
parent e73b163d77
commit 0562771ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ You can define richer enums where the variants carry data. You can then use the
<details>
* The values in the enum variants can only be accessed after being pattern matched. The pattern binds references to the fields in the "match arm" after the `=>`.
* The expressions is matched against the patterns from top to bottom. There is no fall-through like in C or C++.
* The expression is matched against the patterns from top to bottom. There is no fall-through like in C or C++.
* The match expression has a value. The value is the last expression in the match arm which was executed.
* Starting from the top we look for what pattern matches the value then run the code following the arrow. Once we find a match, we stop.
* Demonstrate what happens when the search is inexhaustive. Note the advantage the Rust compiler provides by confirming when all cases are handled.