mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-02-01 22:00:09 +02:00
parent
e73b163d77
commit
0562771ce0
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user