File tree 1 file changed +2
-24
lines changed
1 file changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -12,36 +12,14 @@ use jni::objects::JClass;
12
12
13
13
use jni:: sys:: jlong;
14
14
15
- struct Calc {
16
- instance : calclib:: Calc ,
17
- }
18
-
19
- impl Calc {
20
- pub fn new ( ) -> Self {
21
- Self {
22
- instance : calclib:: Calc :: new ( 0.0 ) ,
23
- }
24
- }
25
-
26
- pub fn add ( & mut self , value : c_double ) -> f64 {
27
- self . instance . add ( value)
28
- }
29
-
30
- pub fn sub ( & mut self , value : c_double ) -> f64 {
31
- self . instance . sub ( value)
32
- }
33
-
34
- pub fn result ( & self ) -> f64 {
35
- self . instance . result ( )
36
- }
37
- }
15
+ use calclib:: Calc ;
38
16
39
17
/// # Safety
40
18
///
41
19
/// This function creates a new instance.
42
20
#[ no_mangle]
43
21
pub unsafe extern "system" fn Java_JavaCalcTest_calcNew ( _env : JNIEnv , _class : JClass ) -> jlong {
44
- let calc = Calc :: new ( ) ;
22
+ let calc = Calc :: new ( 0.0 ) ;
45
23
46
24
Box :: into_raw ( Box :: new ( calc) ) as jlong
47
25
}
You can’t perform that action at this time.
0 commit comments