#quickjs #javascript #js #engine #interpreter


QuickJS Javascript engine wrapper using quickjs fork named quickjspp

9 unstable releases (3 breaking)

0.4.5 Oct 28, 2023
0.4.4 Oct 28, 2023
0.4.3 Aug 15, 2023
0.3.0 Jul 25, 2023
0.1.0 Mar 4, 2023

#136 in Game dev

Download history 43/week @ 2023-08-15 17/week @ 2023-08-22 14/week @ 2023-08-29 20/week @ 2023-09-05 26/week @ 2023-09-12 24/week @ 2023-09-19 10/week @ 2023-09-26 12/week @ 2023-10-03 5/week @ 2023-10-10 13/week @ 2023-10-17 65/week @ 2023-10-24 33/week @ 2023-10-31 13/week @ 2023-11-07 12/week @ 2023-11-14 30/week @ 2023-11-21 42/week @ 2023-11-28

99 downloads per month
Used in 2 crates (via hai_runtime)

MIT license

90K SLoC

C 79K SLoC // 0.0% comments Rust 6.5K SLoC // 0.0% comments C++ 4K SLoC // 0.0% comments


Crates.io docs.rs

This is a fork of quickjs-rs but replaces the binding to the original quickjs by Fabrice Bellard with its fork quickjspp by Andrew Fedoniouk, which is MSVC compatible/compileable.

QuickJS is a new, small Javascript engine by Fabrice Bellard and Charlie Gordon. It is fast and supports the full ES2020 specification.

QuickJSpp is a fork of Quickjs By Andrew Fedoniouk (a.k.a. c-smile).

This crate allows you to easily run and integrate with Javascript code from Rust.


quickjspp = "0.4.5"
use quickjspp::{Context, JsValue};

let context = Context::new().unwrap();

// Eval.

let value = context.eval("1 + 2").unwrap();
assert_eq!(value, JsValue::Int(3));

let value = context.eval_as::<String>(" var x = 100 + 250; x.toString() ").unwrap();
assert_eq!(&value, "350");

// Callbacks.

context.add_callback("myCallback", |a: i32, b: i32| a + b).unwrap();

    // x will equal 30
    var x = myCallback(10, 20);

Optional Features

The crate supports the following features:

  • serde: (default enabled). enable serde method from_js and to_js to transform between Rust types and js value in quickjs context. It should compatible with serde_json but not tested yet. See more on the example.

  • chrono: chrono integration

    • adds a JsValue::Date variant that can be (de)serialized to/from a JS Date
  • bigint: arbitrary precision integer support via num-bigint

  • log: allows forwarding console.log messages to the log crate. Note: must be enabled with ContextBuilder::console(quickjspp::console::LogConsole);

  • patched Enabled automatically for some other features, like bigint. You should not need to enable this manually. Applies QuickJS patches that can be found in libquickjs-sys/embed/patches directory.


By default, quickjs is bundled with the libquickjs-sys crate and automatically compiled, assuming you have the appropriate dependencies.

Windows Support

quickjspp-rs can be used under target x86_64-pc-windows-msvc,

System installation

To use the system installation, without the bundled feature, first install the required dependencies, and then compile and install quickjspp.

You then need to disable the bundled feature in the libquickjs-sys crate to force using the system version.


~44K SLoC