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 @@ -6,7 +6,7 @@ refs/heads/try: bf67eb2362b7d0f37012f2d6dac604c3bbacd2c6
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
- refs/heads/incoming: ac9e694d595a95c75fd96b149bf5e7edce366027
9
+ refs/heads/incoming: f0d0cbfff8d1aadda1cdb3b914361f3355c9a9cc
10
10
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
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 @@ -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