Crate mozjs

source ·
Expand description

This crate contains Rust bindings to the SpiderMonkey Javascript engine developed by Mozilla.

These bindings are designed to be a fairly straightforward translation to the C++ API, while taking advantage of Rust’s memory safety. For more about the Spidermonkey API, see the API Reference and the User Guide on MDN, and the embedding examples on GitHub.

The code from User Guide sections A minimal example and Running scripts are also included.


  • consts 🔒
  • Conversions of Rust values to and from JSVal.
  • Functions to throw JavaScript exceptions from Rust.
  • Rust wrappers for mozjs’s glue module
  • Rust wrappers around the raw JS apis
  • High-level, safe bindings for JS typed array APIs. Allows creating new typed arrays or wrapping existing JS reflectors, and prevents reinterpreting existing buffers as different types except in well-defined cases.