File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
- refs/heads/incoming: 0e14fd6e133a9eec6c3e5f8472ebf6788695781e
9
+ refs/heads/incoming: 2d3396bef191e06568ecbb7c7dd55667db1d8809
10
10
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -742,8 +742,6 @@ struct Stack {
742
742
With a value of such a type, you can do ` mystack.head += 1 ` . If ` mut ` were
743
743
omitted from the type, such an assignment would result in a type error.
744
744
745
- ## Struct patterns
746
-
747
745
Structs can be destructured in ` match ` patterns. The basic syntax is
748
746
` Name {fieldname: pattern, ...} ` :
749
747
~~~~
@@ -845,8 +843,6 @@ let my_gizmo_id = GizmoId(10);
845
843
let id_int: int = *my_gizmo_id;
846
844
~~~~
847
845
848
- ## Enum patterns
849
-
850
846
For enum types with multiple variants, destructuring is the only way to
851
847
get at their contents. All variant constructors can be used as
852
848
patterns, as in this definition of ` area ` :
@@ -862,7 +858,10 @@ fn area(sh: Shape) -> float {
862
858
}
863
859
~~~~
864
860
865
- Another example, matching nullary enum variants:
861
+ Like other patterns, a lone underscore ignores individual fields.
862
+ Ignoring all fields of a variant can be written ` Circle(*) ` . As in
863
+ their introductory form, nullary enum patterns are written without
864
+ parentheses.
866
865
867
866
~~~~
868
867
# type Point = {x: float, y: float};
You can’t perform that action at this time.
0 commit comments