File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: 6e7d5e1cbddeee95a1a7c996b99d78dec0da2954
10
+ refs/heads/dist-snap: ee37f8a0065f5e050b65aadabbb66fcae5085db4
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 @@ -1019,6 +1019,12 @@ To create a new record based on the value of an existing record
1019
1019
you construct it using the ` with ` keyword:
1020
1020
1021
1021
~~~~
1022
+ # impl {x:float, y:float} : core::cmp::Eq {
1023
+ # pure fn eq(&&other: {x:float, y:float}) -> bool {
1024
+ # self.x == other.x && self.y == other.y
1025
+ # }
1026
+ # }
1027
+
1022
1028
let oldpoint = {x: 10f, y: 20f};
1023
1029
let newpoint = {x: 0f with oldpoint};
1024
1030
assert newpoint == {x: 0f, y: 20f};
@@ -1437,7 +1443,10 @@ also done with square brackets (zero-based):
1437
1443
# fn draw_scene(c: crayon) { }
1438
1444
1439
1445
let crayons = ~[banana_mania, beaver, bittersweet];
1440
- if crayons[0] == bittersweet { draw_scene(crayons[0]); }
1446
+ match crayons[0] {
1447
+ bittersweet => draw_scene(crayons[0]),
1448
+ _ => ()
1449
+ }
1441
1450
~~~~
1442
1451
1443
1452
By default, vectors are immutable—you can not replace their elements.
You can’t perform that action at this time.
0 commit comments