[go: up one dir, main page]

dispatch2 0.3.0

Bindings and wrappers for Apple's Grand Central Dispatch (GCD)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use alloc::boxed::Box;
use core::ffi::c_void;

pub(crate) extern "C" fn function_wrapper<F>(work_boxed: *mut c_void)
where
    F: FnOnce(),
{
    // Safety: we reconstruct from a Box.
    let work = unsafe { Box::from_raw(work_boxed.cast::<F>()) };

    (*work)();
}