Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.js in Rust: How to do it and what to expec...

Node.js in Rust: How to do it and what to expect from it

The main goal of this talk is to show that it is possible to embed Node.js runtime in your Rust project and to explain why it can be beneficial.I will guide you through all the crucial steps of embedding Node.js. We will look at the official Node.js C++ embedder API and what we can do with Rust’s FFI despite its lack of C++ support. Much of this is the result of the embedding experiments I did while helping build Orogene - a package manager for Node.js-compatible projects that is written in Rust.

Kirill Vasiltsov

September 18, 2021
Tweet

More Decks by Kirill Vasiltsov

Other Decks in Programming

Transcript

  1. Node.js in Rust: how to do it and what to

    expect from it Kirill Vasiltcov @virtualkirill
  2. in

  3. in

  4. in

  5. • Run JavaScript without "shelling out“ • Shim module loading

    (and resolution) logic 🤔 🤔 Content- addressable cache?
  6. FFI

  7. Fortunately, • Node.js can be compiled as a library •

    Node.js embedder API example has an extremely simple call signature • It is easy to export C functions from C++