docs.rs failed to build mquickjs-rs-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
mquickjs-rs
Safe, idiomatic Rust wrapper for the MicroQuickJS engine.
Installation
Or in Cargo.toml:
= "0.2.0"
Usage
use ;
let runtime = new.expect;
let ctx = runtime.context.expect;
let sum = ctx.eval_i32.expect;
assert_eq!;
ctx.register_fn
.expect;
let echoed = ctx
.eval_string
.expect;
assert_eq!;
Conversions
use ;
let runtime = new.expect;
let ctx = runtime.context.expect;
let value = 42i32.into_value.expect;
let result = i32from_value.expect;
assert_eq!;
Objects and arrays
use ;
let runtime = new.expect;
let ctx = runtime.context.expect;
let obj_value = ctx.eval.expect;
let obj = from_value.expect;
obj.set.expect;
let name: String = obj.get.expect;
assert_eq!;
let array_value = ctx.eval.expect;
let array = from_value.expect;
array.push.expect;
let first: i32 = array.get.expect;
assert_eq!;
Persistent handles
use ;
let runtime = new.expect;
let ctx = runtime.context.expect;
let value = ctx.eval.expect;
let persistent = new.expect;
let roundtrip = persistent.to_value.to_string.expect;
assert_eq!;
Notes
- MicroQuickJS runs in a stricter ES5-like mode. See
../../mquickjs/README.mdfor engine limitations. - The JS context requires a preallocated memory buffer (minimum 1024 bytes).
License
MIT