Skip to content

Commit d7346f7

Browse files
committed
doc: Fix README.md examples to use results
1 parent f85d4be commit d7346f7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ pub extern fn test_it_free(test_it: *mut TestIt) {
4444
}
4545

4646
#[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)? };
4949
test_it.add(value);
5050
// Here will NOT be dropped, the pointer continues been valid.
51+
return Ok(());
5152
}
5253

5354
#[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());
5758
// Here will NOT be dropped, the pointer continues been valid.
5859
}
5960
```

0 commit comments

Comments
 (0)