File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -44,16 +44,17 @@ pub extern fn test_it_free(test_it: *mut TestIt) {
44
44
}
45
45
46
46
#[no_mangle]
47
- pub extern fn test_it_add (test_it : * mut TestIt , value : u8 ) {
48
- let test_it = unsafe { opaque_pointer :: mut_object (test_it ) };
47
+ pub extern fn test_it_add (test_it : * mut TestIt , value : u8 ) -> Result <(), opaque_pointer :: error :: PointerError > {
48
+ let test_it = unsafe { opaque_pointer :: mut_object (test_it )? };
49
49
test_it . add (value );
50
50
// Here will NOT be dropped, the pointer continues been valid.
51
+ return Ok (());
51
52
}
52
53
53
54
#[no_mangle]
54
- pub extern fn test_it_get (test_it : * const TestIt ) -> u8 {
55
- let test_it = unsafe { opaque_pointer :: object (test_it ) };
56
- return test_it . get ();
55
+ pub extern fn test_it_get (test_it : * const TestIt ) -> Result < u8 , opaque_pointer :: error :: PointerError > {
56
+ let test_it = unsafe { opaque_pointer :: object (test_it )? };
57
+ return Ok ( test_it . get () );
57
58
// Here will NOT be dropped, the pointer continues been valid.
58
59
}
59
60
```
You can’t perform that action at this time.
0 commit comments