Destructuring patterns
Anywhere Rust accepts a binding, it accepts a pattern. That is one rule with a lot of reach: `let`, function parameters, `for` loops, `match` arms and `if let` all use the same syntax.
Destructuring keeps names close to the data they describe, and it avoids a trail of `.0`, `.1` and `.2` accesses that nobody can read later.
The `..` pattern skips the fields you do not care about, and `_` ignores a single value without binding it.
Run it and change it
The editor below is live: edit anything and the real compiler output updates by itself.
Contrast AAA · 16.6:1
15px