mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-08 09:00:12 +02:00
Removed destructuring about struct (#1924)
#1464 issue . Let's limit this section to arrays and tuples. Destructuring in structs explained in [Day-2 Morning]((https://google.github.io/comprehensive-rust/pattern-matching/destructuring.html)).
This commit is contained in:
parent
b06cc21c39
commit
e5e33a1159
@ -26,20 +26,6 @@ fn print_tuple(tuple: (i32, i32)) {
|
||||
}
|
||||
```
|
||||
|
||||
This works with any kind of structured value:
|
||||
|
||||
```rust,editable
|
||||
struct Foo {
|
||||
a: i32,
|
||||
b: bool,
|
||||
}
|
||||
|
||||
fn print_foo(foo: Foo) {
|
||||
let Foo { a, b } = foo;
|
||||
println!("a: {a}, b: {b}");
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
- The patterns used here are "irrefutable", meaning that the compiler can
|
||||
|
Loading…
Reference in New Issue
Block a user