Skip to main content

JS_NewCFunctionData

Function JS_NewCFunctionData 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_NewCFunctionData( ctx: *mut JsContext, func: CFunctionData, length: c_int, magic: c_int, data_len: c_int, data: *const JsValue, ) -> JsValue
Expand description

JS_NewCFunctionData: a function carrying data_len captured values.

The captured values are handed to the callback as its trailing argv entries, which is how a C module builds a closure — JS_CFUNC_DEF has no other way to carry state.

§Safety

func must be a JSCFunctionData; data must point at data_len live values.