quickjs_runtime::quickjs_utils::functions

Function new_function

source
pub unsafe fn new_function<F>(
    context: *mut JSContext,
    name: &str,
    func: F,
    arg_count: u32,
) -> Result<QuickJsValueAdapter, JsError>
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