jolt_quickjs 0.1.3

QuickJS backend for the Jolt JavaScript runtime
Documentation

jolt_quickjs

crates.io docs.rs

QuickJS backend for the Jolt JavaScript runtime.

Uses QuickJS via the rquickjs crate. Adds ~1 MB to your binary with no JIT — suitable for Android, Linux, Windows, and any other non-Apple, non-WASM target.

Usage

use jolt_quickjs::QuickJsRuntime;
use jolt_core::{JsRuntime, JsValue};

let mut rt = QuickJsRuntime::new().unwrap();

let result = rt.eval("2 + 2").unwrap();
assert_eq!(result, JsValue::Int(4));

rt.set_global("name", JsValue::from("world")).unwrap();
let greeting = rt.eval("`Hello, ${name}!`").unwrap();

rt.register_function("double", |args| {
    Ok(JsValue::Int(args[0].as_i64().unwrap() * 2))
}).unwrap();

License

MIT