1
0
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:
Manichand Kondapaka 2024-03-20 02:19:26 +05:30 committed by GitHub
parent b06cc21c39
commit e5e33a1159
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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