Attribute Macro function_callback

Source
#[function_callback]
Expand description

Transforms a Rust function into a C function for being used as a JavaScript callback.

This function_callback procedural macro transforms a Rust function of type:

fn(
    context: &JSContext,
    function: Option<&JSObject>,
    this_object: Option<&JSObject>,
    arguments: &[JSValue]
) -> Result<JSValue, JSException>

into a javascriptcore_sys::JSObjectCallAsFunctionCallback function.

Check the documentation of javascriptcore::JSValue::new_function to learn more.