We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48ca6d1 commit 72beb1fCopy full SHA for 72beb1f
src/doc/guide.md
@@ -3991,6 +3991,22 @@ match origin {
3991
}
3992
```
3993
3994
+You can do this kind of match on any member, not just the first:
3995
+
3996
+```{rust}
3997
+# #![allow(non_shorthand_field_patterns)]
3998
+struct Point {
3999
+ x: int,
4000
+ y: int,
4001
+}
4002
4003
+let origin = Point { x: 0i, y: 0i };
4004
4005
+match origin {
4006
+ Point { y: y, .. } => println!("y is {}", y),
4007
4008
+```
4009
4010
Whew! That's a lot of different ways to match things, and they can all be
4011
mixed and matched, depending on what you're doing:
4012
0 commit comments