High-level bindings and serializers for a Wasm build of QuickJS.
JSContextRef
corresponds to a QuickJS JSContext
and JSValueRef
corresponds to a QuickJS JSValue
.
```rust use quickjswasmrs::JSContextRef;
let mut context = JSContextRef::default(); ```
will create a new context.
This crate provides optional transcoding features for converting between
serialization formats and JSValueRef
:
- messagepack
provides quickjs_wasm_rs::messagepack
for msgpack, using rmp_serde
.
- json
provides quickjs_wasm_rs::json
for JSON, using serde_json
.
msgpack example:
```rust use quickjswasmrs::{messagepack, JSContextRef, JSValueRef};
let context = JSContextRef::default(); let inputbytes: &[u8] = ...; let inputvalue = messagepack::transcodeinput(&context, inputbytes).unwrap(); let outputvalue: JSValueRef = ...; let output = messagepack::transcodeoutput(output_value).unwrap(); ```
To publish this crate to crates.io, run ./publish.sh
.
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.