reference: make tuple usage examples more meaningful

This commit is contained in:
Tshepang Lekhonkhobe 2015-07-05 13:01:42 +02:00
parent 912ab64a0d
commit 72c027535a

View File

@ -3322,10 +3322,13 @@ An example of a tuple type and its use:
```
type Pair<'a> = (i32, &'a str);
let p: Pair<'static> = (10, "hello");
let p: Pair<'static> = (10, "ten");
let (a, b) = p;
assert!(b != "world");
assert!(p.0 == 10);
assert_eq!(a, 10);
assert_eq!(b, "ten");
assert_eq!(p.0, 10);
assert_eq!(p.1, "ten");
```
For historical reasons and convenience, the tuple type with no elements (`()`)