28 releases (5 breaking)
|Feb 21, 2024
|Jan 29, 2024
|Dec 8, 2023
|Aug 18, 2023
|Mar 8, 2020
#28 in FFI
27,496 downloads per month
Used in 21 crates (15 directly)
Main features of QuickJS
- Small and easily embeddable: just a few C files, no external dependency, 210 KiB of x86 code for a simple hello world program.
- Fast interpreter with very low startup time: runs the 75000 tests of the ECMAScript Test Suite in about 100 seconds on a single core of a desktop PC. The complete life cycle of a runtime instance completes in less than 300 microseconds.
- Almost complete ES2020 support including modules, asynchronous generators and full Annex B support (legacy web compatibility).
- Passes nearly 100% of the ECMAScript Test Suite tests when selecting the ES2020 features. A summary is available at Test262 Report.
- Garbage collection using reference counting (to reduce memory usage and have deterministic behavior) with cycle removal.
- Mathematical extensions: BigDecimal, BigFloat, operator overloading, bigint mode, math mode.
- Small built-in standard library with C library wrappers.
Features provided by this crate
- Full integration with async Rust
- The ES6 Promises can be handled as Rust futures and vice versa
- Easy integration with almost any async runtime or executor
- Flexible data conversion between Rust and JS
- Many widely used Rust types can be converted to JS and vice versa
IntoJsderive macros can help adapt user defined types too
- Support for user-defined allocators
Runtimecan be created using custom allocator
- Using Rust's global allocator is also fully supported
- Support for user-defined module resolvers and loaders which also can be combined to get more flexible solution for concrete case
- Support for bundling JS modules as a bytecode using
- Support for deferred calling of JS functions
- Full support of ES6 classes
- Rust data types can be represented as JS classes
- Data fields can be accessed via object properties
- Both static and instance members is also supported
- The properties can be defined with getters and setters
- Support for constant static properties
- Support for holding references to JS objects
(Data type which holds refs should implement
HasRefstrait to get garbage collector works properly)
- Support for extending defined classes by JS
- Easy bindings using proc macro
(The interfacing between JS and Rust became much easy with
This bindings is feature complete, mostly stable and ready to use.
The error handling is only thing which may change in the future.
Some experimental features like
parallel may not works as expected. Use it for your own risk.
Using rquickjs on windows
Note that the QuickJS library does not support windows natively, this library supports windows by patching QuickJS.
For patching we use the
patch utility which needs to be installed when building for windows.
For more information see #88.
This library is licensed under the MIT License