File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 728d16cfca4d1d12fdabbcc666071810c4d94dc9
2
+ refs/heads/master: 22ef08293e69a5bec54874c30ec7652e7d917da0
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments