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<QuickJsValueAdapter, JsError>where
F: Fn(*mut JSContext, &QuickJsValueAdapter, &[QuickJsValueAdapter]) -> Result<QuickJsValueAdapter, 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