You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A struct pattern used to match a union must specify exactly one field (see [Pattern matching on unions]).
811
811
812
812
r[patterns.struct.binding-shorthand]
813
-
The `ref` and/or `mut`[IDENTIFIER] syntax matches any value and binds it to a variable with the same name as the given field.
813
+
The [IDENTIFIER] syntax matches any value and binds it to a variable with the same name as the given field. It is a shorthand for `fieldname: fieldname`. The `ref` and `mut` qualifiers can be included with the behavior as described in [patterns.ident.ref].
814
814
815
815
```rust
816
816
# structStruct {
@@ -820,7 +820,7 @@ The `ref` and/or `mut` [IDENTIFIER] syntax matches any value and binds it to a v
820
820
# }
821
821
# letstruct_value=Struct{a:10, b:'X', c:false};
822
822
#
823
-
letStruct{a:x, b:y, c:z} =struct_value;// destructure all fields
0 commit comments