File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -598,17 +598,21 @@ we have function pointers flying across the FFI boundary in both directions.
598
598
``` rust
599
599
use std :: os :: raw :: c_int;
600
600
601
+ # #[cfg(hidden)]
601
602
extern " C" {
602
603
/// Register the callback.
603
604
fn register (cb : Option <extern "C " fn (Option <extern "C " fn (c_int ) -> c_int >, c_int ) -> c_int >);
604
605
}
606
+ # unsafe fn register (_ : Option <extern "C " fn (Option <extern "C " fn (c_int ) -> c_int >,
607
+ # c_int ) -> c_int >)
608
+ # {}
605
609
606
610
/// This fairly useless function receives a function pointer and an integer
607
611
/// from C, and returns the result of calling the function with the integer.
608
612
/// In case no function is provided, it squares the integer by default.
609
613
extern " C" fn apply (process : Option <extern "C " fn (c_int ) -> c_int >, int : c_int ) -> c_int {
610
614
match process {
611
- Some (f ) => unsafe { f (int ) } ,
615
+ Some (f ) => f (int ),
612
616
None => int * int
613
617
}
614
618
}
You can’t perform that action at this time.
0 commit comments