@@ -21,18 +21,18 @@ enum PolymorphicMovement {
21
21
}
22
22
23
23
ocaml_export ! {
24
- fn rust_twice( cr, num: OCamlRooted <OCamlInt >) -> OCaml <OCamlInt > {
24
+ fn rust_twice( cr, num: & OCamlRooted <OCamlInt >) -> OCaml <OCamlInt > {
25
25
let num: i64 = num. to_rust( cr) ;
26
26
unsafe { OCaml :: of_i64_unchecked( num * 2 ) }
27
27
}
28
28
29
- fn rust_twice_boxed_i64( cr, num: OCamlRooted <OCamlInt64 >) -> OCaml <OCamlInt64 > {
29
+ fn rust_twice_boxed_i64( cr, num: & OCamlRooted <OCamlInt64 >) -> OCaml <OCamlInt64 > {
30
30
let num: i64 = num. to_rust( cr) ;
31
31
let result = num * 2 ;
32
32
result. to_ocaml( cr)
33
33
}
34
34
35
- fn rust_twice_boxed_i32( cr, num: OCamlRooted <OCamlInt32 >) -> OCaml <OCamlInt32 > {
35
+ fn rust_twice_boxed_i32( cr, num: & OCamlRooted <OCamlInt32 >) -> OCaml <OCamlInt32 > {
36
36
let num: i32 = num. to_rust( cr) ;
37
37
let result = num * 2 ;
38
38
result. to_ocaml( cr)
@@ -42,7 +42,7 @@ ocaml_export! {
42
42
num * num2
43
43
}
44
44
45
- fn rust_twice_boxed_float( cr, num: OCamlRooted <OCamlFloat >) -> OCaml <OCamlFloat > {
45
+ fn rust_twice_boxed_float( cr, num: & OCamlRooted <OCamlFloat >) -> OCaml <OCamlFloat > {
46
46
let num: f64 = num. to_rust( cr) ;
47
47
let result = num * 2.0 ;
48
48
result. to_ocaml( cr)
@@ -52,7 +52,7 @@ ocaml_export! {
52
52
num * 2.0
53
53
}
54
54
55
- fn rust_increment_bytes( cr, bytes: OCamlRooted <OCamlBytes >, first_n: OCamlRooted <OCamlInt >) -> OCaml <OCamlBytes > {
55
+ fn rust_increment_bytes( cr, bytes: & OCamlRooted <OCamlBytes >, first_n: & OCamlRooted <OCamlInt >) -> OCaml <OCamlBytes > {
56
56
let first_n: i64 = first_n. to_rust( cr) ;
57
57
let first_n = first_n as usize ;
58
58
let mut vec: Vec <u8 > = bytes. to_rust( cr) ;
@@ -64,7 +64,7 @@ ocaml_export! {
64
64
vec. to_ocaml( cr)
65
65
}
66
66
67
- fn rust_increment_ints_list( cr, ints: OCamlRooted <OCamlList <OCamlInt >>) -> OCaml <OCamlList <OCamlInt >> {
67
+ fn rust_increment_ints_list( cr, ints: & OCamlRooted <OCamlList <OCamlInt >>) -> OCaml <OCamlList <OCamlInt >> {
68
68
let mut vec: Vec <i64 > = ints. to_rust( cr) ;
69
69
70
70
for i in 0 ..vec. len( ) {
@@ -74,45 +74,45 @@ ocaml_export! {
74
74
vec. to_ocaml( cr)
75
75
}
76
76
77
- fn rust_make_tuple( cr, fst: OCamlRooted <String >, snd: OCamlRooted <OCamlInt >) -> OCaml <( String , OCamlInt ) > {
77
+ fn rust_make_tuple( cr, fst: & OCamlRooted <String >, snd: & OCamlRooted <OCamlInt >) -> OCaml <( String , OCamlInt ) > {
78
78
let fst: String = fst. to_rust( cr) ;
79
79
let snd: i64 = snd. to_rust( cr) ;
80
80
let tuple = ( fst, snd) ;
81
81
tuple. to_ocaml( cr)
82
82
}
83
83
84
- fn rust_make_some( cr, value: OCamlRooted <String >) -> OCaml <Option <String >> {
84
+ fn rust_make_some( cr, value: & OCamlRooted <String >) -> OCaml <Option <String >> {
85
85
let value: String = value. to_rust( cr) ;
86
86
let some_value = Some ( value) ;
87
87
some_value. to_ocaml( cr)
88
88
}
89
89
90
- fn rust_make_ok( cr, value: OCamlRooted <OCamlInt >) -> OCaml <Result <OCamlInt , String >> {
90
+ fn rust_make_ok( cr, value: & OCamlRooted <OCamlInt >) -> OCaml <Result <OCamlInt , String >> {
91
91
let value: i64 = value. to_rust( cr) ;
92
92
let ok_value: Result <i64 , String > = Ok ( value) ;
93
93
to_ocaml!( cr, ok_value)
94
94
}
95
95
96
- fn rust_make_error( cr, value: OCamlRooted <String >) -> OCaml <Result <OCamlInt , String >> {
96
+ fn rust_make_error( cr, value: & OCamlRooted <String >) -> OCaml <Result <OCamlInt , String >> {
97
97
let value: String = value. to_rust( cr) ;
98
98
let error_value: Result <i64 , String > = Err ( value) ;
99
99
to_ocaml!( cr, error_value)
100
100
}
101
101
102
- fn rust_sleep_releasing( cr, millis: OCamlRooted <OCamlInt >) {
102
+ fn rust_sleep_releasing( cr, millis: & OCamlRooted <OCamlInt >) {
103
103
let millis: i64 = millis. to_rust( cr) ;
104
104
cr. releasing_runtime( || thread:: sleep( time:: Duration :: from_millis( millis as u64 ) ) ) ;
105
105
OCaml :: unit( )
106
106
}
107
107
108
- fn rust_sleep( cr, millis: OCamlRooted <OCamlInt >) {
108
+ fn rust_sleep( cr, millis: & OCamlRooted <OCamlInt >) {
109
109
let millis: i64 = millis. to_rust( cr) ;
110
110
thread:: sleep( time:: Duration :: from_millis( millis as u64 ) ) ;
111
111
OCaml :: unit( )
112
112
}
113
113
114
- fn rust_string_of_movement( cr, movement: OCamlRooted <PolymorphicMovement >) -> OCaml <String > {
115
- let movement = cr. get( & movement) ;
114
+ fn rust_string_of_movement( cr, movement: & OCamlRooted <PolymorphicMovement >) -> OCaml <String > {
115
+ let movement = cr. get( movement) ;
116
116
let pm = ocaml_unpack_variant! {
117
117
movement => {
118
118
Step ( count: OCamlInt ) => { Movement :: Step { count} } ,
@@ -129,8 +129,8 @@ ocaml_export! {
129
129
to_ocaml!( cr, s)
130
130
}
131
131
132
- fn rust_string_of_polymorphic_movement( cr, polymorphic_movement: OCamlRooted <PolymorphicMovement >) -> OCaml <String > {
133
- let polymorphic_movement = cr. get( & polymorphic_movement) ;
132
+ fn rust_string_of_polymorphic_movement( cr, polymorphic_movement: & OCamlRooted <PolymorphicMovement >) -> OCaml <String > {
133
+ let polymorphic_movement = cr. get( polymorphic_movement) ;
134
134
let pm = ocaml_unpack_polymorphic_variant! {
135
135
polymorphic_movement => {
136
136
Step ( count: OCamlInt ) => { PolymorphicMovement :: Step { count} } ,
0 commit comments