You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-17 22:57:35 +02:00
Update destructuring-enums.md (#231)
This commit is contained in:
@ -29,3 +29,11 @@ fn main() {
|
|||||||
Here we have used the arms to _destructure_ the `Result` value. In the first
|
Here we have used the arms to _destructure_ the `Result` value. In the first
|
||||||
arm, `half` is bound to the value inside the `Ok` variant. In the second arm,
|
arm, `half` is bound to the value inside the `Ok` variant. In the second arm,
|
||||||
`msg` is bound to the error message.
|
`msg` is bound to the error message.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
Consider demonstrating what happens if you add the third enum variant. Rust
|
||||||
|
will try to be helpful and the code won't compile, because you haven't handled
|
||||||
|
the new case in your match statements.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
Reference in New Issue
Block a user