Macro big_json_args

Source
macro_rules! big_json_args {
    ($($arg:expr),*) => { ... };
}
Expand description

Map a series of values into a form which javascript functions can understand
This forms a Vec<serde_json::Value> from the provided arguments

Useful if you need more than 16 arguments for a single function call

Warning: This macro is far slower than json_args! and should be used sparingly
Benchmarks place the performance difference at nearly 1,000 times slower!

§Example

use rustyscript::{ Runtime, RuntimeOptions, Module, big_json_args };
use std::time::Duration;

let module = Module::new("test.js", "
    function load(a, b) {
        console.log(`Hello world: a=${a}, b=${b}`);
    }
    rustyscript.register_entrypoint(load);
");

Runtime::execute_module(
    &module, vec![],
    Default::default(),
    big_json_args!("test", 5)
)?;