rust-nodejs
Embedding Node.js in Rust.
- Provide a global thread-safe Node.js event queue.
- Interact with the Node.js runtime via Neon API.
- Link with prebuilt Node.js binaries to save compile time.
- Native modules are supported.
Usage
- Add rust-nodejs to your cargo project:
[]
= "0.1.1"
let queue = nodejs::event_queue()
to get the global Node.js event queue.- Call
queue.send
to run tasks in the Node.js event queue - Inside the task, use
nodejs::neon
for interoperability between Node.js and Rust. Neon documentation - On macOS or Linux, add
-Clink-args=-rdynamic
torustflags
when building your Rust application.
Example
use ;