build_closure_trampoline

Function build_closure_trampoline 

Source
pub unsafe fn build_closure_trampoline<F>(
    closure: F,
) -> ((Box<WrappedCallback>, Box<JSValue>), JSCFunctionData)
where F: Fn(c_int, *mut JSValue) -> JSValue + 'static,
Expand description

Taken from: https://s3.amazonaws.com/temp.michaelfbryan.com/callbacks/index.html

Create a C wrapper function for a Rust closure to enable using it as a callback function in the Quickjs runtime.

Both the boxed closure and the boxed data are returned and must be stored by the caller to guarantee they stay alive.