This crate is deprecated.
The motivation for this change is explained in detail in https://github.com/bytecodealliance/javy/pull/618
We recommend using rquickjs
as the
high-level bindings for QuickJS.
quickjs-wasm-rs
High-level bindings and serializers for a Wasm build of QuickJS.
Bindings
JSContextRef
corresponds to a QuickJS JSContext
and JSValueRef
corresponds to a QuickJS JSValue
.
use JSContextRef;
let mut context = default;
will create a new context.
Serializers
This crate provides optional transcoding features for converting between
serialization formats and JSValueRef
:
messagepack
providesquickjs_wasm_rs::messagepack
for msgpack, usingrmp_serde
.json
providesquickjs_wasm_rs::json
for JSON, usingserde_json
.
msgpack example:
use ;
let context = default;
let input_bytes: & = ...;
let input_value = transcode_input.unwrap;
let output_value: JSValueRef = ...;
let output = transcode_output.unwrap;
Publishing to crates.io
To publish this crate to crates.io, run ./publish.sh
.
Using a custom WASI SDK
This crate can be compiled using a custom WASI SDK. When building this crate, set the QUICKJS_WASM_SYS_WASI_SDK_PATH
environment variable to the absolute path where you installed the SDK.