Skip to content

Commit ffc5857

Browse files
committed
---
yaml --- r: 22711 b: refs/heads/master c: 22ef082 h: refs/heads/master i: 22709: 4d11df3 22707: 65ba471 22703: b9f95d6 v: v3
1 parent 9be20b4 commit ffc5857

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,5 +1,5 @@
11
---
2-
refs/heads/master: 728d16cfca4d1d12fdabbcc666071810c4d94dc9
2+
refs/heads/master: 22ef08293e69a5bec54874c30ec7652e7d917da0
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
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)