pub fn raw_callback<F>(_closure: &F) -> Callback
where
    F: FnMut(i32) -> i32,
{
    unsafe extern "C" fn wrapper<P>(user_data: *mut c_void, arg: i32) -> i32
    where
        P: FnMut(i32) -> i32,
    {
        let cb = &mut *(user_data as *mut P);

        cb(arg)
    }

    wrapper::<F>
}
/// Get a function pointer which can be used as a [`Callback`] that accepts a
/// pointer to the closure as its `user_data`.
Get a function pointer which can be used as a [`Callback`] that accepts a
pointer to the closure as its `user_data`.
Get a function pointer which can be used as a [ ` Callback ` ] that accepts a pointer to the closure as its ` user_data ` .
pub fn raw_callback<F>(_closure: &F) -> Callback
where
    F: FnMut(i32) -> i32,
{
    unsafe extern "C" fn wrapper<P>(user_data: *mut c_void, arg: i32) -> i32
    where
        P: FnMut(i32) -> i32,
    {
        let cb = &mut *(user_data as *mut P);
        cb(arg)
    }
    wrapper::<F>
}
pub fn raw_callback < F > ( _closure : & F ) -> Callback where F : FnMut ( i32 ) -> i32 , { unsafe extern " " fn wrapper < P > ( user_data : * mut c_void , arg : i32 ) -> i32 where P : FnMut ( i32 ) -> i32 , { let cb = & mut * ( user_data as * mut P ) ; cb ( arg ) } wrapper :: < F > }
Get a function pointer which can be used as a [`Callback`] that accepts a
pointer to the closure as its `user_data`.
Get a function pointer which can be used as a [ ` Callback ` ] that accepts a pointer to the closure as its ` user_data ` .
_closure
&F
_closure
&F