quickjs-rs
A Rust wrapper for QuickJS.
QuickJS is a new, small Javascript engine by Fabrice Bellard. It is fast and supports the full ES2019 specification.
This crate allows you to easily run and integrate with Javascript code from Rust.
Limitations
- JS objects can not be deserialized into Rust (JsValue::Object) due to a missing property enumeration API (will be fixed soon)
- Windows is not supported yet
Usage
[]
= "0.2.0"
use ;
let context = new.unwrap;
// Eval.
let value = context.eval.unwrap;
assert_eq!;
let value = context..unwrap;
assert_eq!;
// Callbacks.
context.add_callback.unwrap;
context.eval.unwrap;
Installation
By default, quickjs is bundled with the libquickjs-sys
crate and
automatically compiled, assuming you have the appropriate dependencies.
If you would like to use a system version instead, see below.
QuickJS will always be statically linked to your binary.
System installation
To use the system installation, without the bundled feature, first install the required dependencies, and then compile and install quickjs.
# Debian/Ubuntu: apt-get install -y curl xz-utils build-essential gcc-multilib libclang-dev clang
|