@@ -9,41 +9,48 @@ struct Foo;
9
9
impl Fn < ( isize , isize ) > for Foo {
10
10
extern "rust-call" fn call ( & self , args : ( isize , isize ) ) -> Self :: Output {
11
11
println ! ( "{:?}" , args) ;
12
+ ( args. 0 + 1 , args. 1 + 1 )
12
13
}
13
14
}
14
15
15
16
impl FnMut < ( isize , isize ) > for Foo {
16
17
extern "rust-call" fn call_mut ( & mut self , args : ( isize , isize ) ) -> Self :: Output {
17
18
println ! ( "{:?}" , args) ;
19
+ ( args. 0 + 1 , args. 1 + 1 )
18
20
}
19
21
}
20
22
21
23
impl FnOnce < ( isize , isize ) > for Foo {
22
- type Output = ( ) ;
24
+ type Output = ( isize , isize ) ;
23
25
extern "rust-call" fn call_once ( self , args : ( isize , isize ) ) -> Self :: Output {
24
26
println ! ( "{:?}" , args) ;
27
+ ( args. 0 + 1 , args. 1 + 1 )
25
28
}
26
29
}
27
30
28
31
impl Fn < ( isize , isize , isize ) > for Foo {
29
32
extern "rust-call" fn call ( & self , args : ( isize , isize , isize ) ) -> Self :: Output {
30
33
println ! ( "{:?}" , args) ;
34
+ ( args. 0 + 3 , args. 1 + 3 , args. 2 + 3 )
31
35
}
32
36
}
33
37
34
38
impl FnMut < ( isize , isize , isize ) > for Foo {
35
39
extern "rust-call" fn call_mut ( & mut self , args : ( isize , isize , isize ) ) -> Self :: Output {
36
40
println ! ( "{:?}" , args) ;
41
+ ( args. 0 + 3 , args. 1 + 3 , args. 2 + 3 )
37
42
}
38
43
}
39
44
impl FnOnce < ( isize , isize , isize ) > for Foo {
40
- type Output = ( ) ;
45
+ type Output = ( isize , isize , isize ) ;
41
46
extern "rust-call" fn call_once ( self , args : ( isize , isize , isize ) ) -> Self :: Output {
42
47
println ! ( "{:?}" , args) ;
48
+ ( args. 0 + 3 , args. 1 + 3 , args. 2 + 3 )
43
49
}
44
50
}
45
51
46
52
fn main ( ) {
47
53
let foo = Foo ;
48
- foo ( 1 , 1 ) ;
54
+ assert_eq ! ( foo( 1 , 1 ) , ( 2 , 2 ) ) ;
55
+ assert_eq ! ( foo( 1 , 1 , 1 ) , ( 4 , 4 , 4 ) ) ;
49
56
}
0 commit comments