Function quickjs_runtime::quickjs_utils::functions::new_function
source · [−]pub unsafe fn new_function<F>(
context: *mut JSContext,
name: &str,
func: F,
arg_count: u32
) -> Result<JSValueRef, JsError> where
F: Fn(*mut JSContext, &JSValueRef, &[JSValueRef]) -> Result<JSValueRef, JsError> + 'static,
Expand description
create a new Function which is backed by a closure
Safety
When passing a context pointer please make sure the corresponding QuickJsContext is still valid