Giter Club home page Giter Club logo

rquickjs's Introduction

rquickjs

github crates docs status

This library is a high level bindings the QuickJS javascript engine. Its goal is to be an easy to use, and safe wrapper similar to the rlua library.

QuickJS is a small and embeddable Javascript engine. It supports the ES2020 specification including modules, asynchronous generators, proxies and BigInt. It optionally supports mathematical extensions such as big decimal floating point numbers (BigDecimal), big binary floating point numbers (BigFloat) and operator overloading.

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.
  • Can compile Javascript sources to executables with no external dependency.
  • 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.
  • Command line interpreter with contextual colorization implemented in Javascript.
  • 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
    • Both Tokio and AsyncStd runtimes supported natively
    • 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
    • FromJs and IntoJs derive macros can help adapt user defined types too
  • Support for user-defined allocators
    • The Runtime can 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 embed macro
  • 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 HasRefs trait 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 bind macro)

Development status

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.

License

This library is licensed under the MIT License

rquickjs's People

Contributors

delskayn avatar gondaruk avatar katyo avatar ryangjchandler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.