File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
14
14
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
15
15
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
16
16
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17
- refs/heads/auto: ac9e694d595a95c75fd96b149bf5e7edce366027
17
+ refs/heads/auto: f0d0cbfff8d1aadda1cdb3b914361f3355c9a9cc
18
18
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
19
19
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
Original file line number Diff line number Diff line change @@ -1653,12 +1653,11 @@ Path expressions are [lvalues](#lvalues-rvalues-and-temporaries).
1653
1653
1654
1654
### Tuple expressions
1655
1655
1656
- Tuples are written by enclosing one or more comma-separated
1656
+ Tuples are written by enclosing two or more comma-separated
1657
1657
expressions in parentheses. They are used to create [ tuple-typed] ( #tuple-types )
1658
1658
values.
1659
1659
1660
1660
~~~~~~~~ {.tuple}
1661
- (0,);
1662
1661
(0f, 4.5f);
1663
1662
("a", 4u, true);
1664
1663
~~~~~~~~
@@ -2579,7 +2578,7 @@ to the record type-constructor. The differences are as follows:
2579
2578
2580
2579
Tuple types and values are denoted by listing the types or values of their
2581
2580
elements, respectively, in a parenthesized, comma-separated
2582
- list.
2581
+ list. Single-element tuples are not legal; all tuples have two or more values.
2583
2582
2584
2583
The members of a tuple are laid out in memory contiguously, like a record, in
2585
2584
order specified by the tuple type.
Original file line number Diff line number Diff line change @@ -495,7 +495,10 @@ omitted.
495
495
496
496
A powerful application of pattern matching is * destructuring* :
497
497
matching in order to bind names to the contents of data
498
- types. Assuming that ` (float, float) ` is a tuple of two floats:
498
+ types.
499
+
500
+ > *** Note:*** The following code makes use of tuples (` (float, float) ` ) which
501
+ > are explained later. For now you can think of tuples as a list of items.
499
502
500
503
~~~~
501
504
fn angle(vector: (float, float)) -> float {
@@ -747,7 +750,7 @@ fn area(sh: Shape) -> float {
747
750
748
751
Tuples in Rust behave exactly like structs, except that their fields
749
752
do not have names. Thus, you cannot access their fields with dot notation.
750
- Tuples can have any arity except for 0 (though you may consider
753
+ Tuples can have any arity except for 0 or 1 (though you may consider
751
754
unit, ` () ` , as the empty tuple if you like).
752
755
753
756
~~~~
You can’t perform that action at this time.
0 commit comments