Skip to content

Commit 9c87039

Browse files
committed
---
yaml --- r: 20603 b: refs/heads/snap-stage3 c: 22ef082 h: refs/heads/master i: 20601: b379fbc 20599: 755c235 v: v3
1 parent bc42b4b commit 9c87039

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 728d16cfca4d1d12fdabbcc666071810c4d94dc9
4+
refs/heads/snap-stage3: 22ef08293e69a5bec54874c30ec7652e7d917da0
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
trait Product {
2+
fn product() -> int;
3+
}
4+
5+
struct Foo {
6+
x: int;
7+
y: int;
8+
}
9+
10+
impl Foo {
11+
fn sum() -> int {
12+
self.x + self.y
13+
}
14+
}
15+
16+
impl Foo : Product {
17+
fn product() -> int {
18+
self.x * self.y
19+
}
20+
}
21+
22+
fn Foo(x: int, y: int) -> Foo {
23+
Foo { x: x, y: y }
24+
}
25+
26+
fn main() {
27+
let foo = Foo(3, 20);
28+
io::println(#fmt("%d %d", foo.sum(), foo.product()));
29+
}
30+

0 commit comments

Comments
 (0)