rust-nodejs
Embedding Node.js in Rust.
- Queue tasks to the Node.js event loop thread-safely.
- Interact with the Node.js runtime via Neon API.
- Link with prebuilt Node.js binaries to save compile time.
- Native modules are supported.
Guide
let channel = nodejs::channel()
to get the global Node.js channel.- Call
channel.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
Example
let = ;
let channel = channel;
channel.send;
let whoami = rx.recv.unwrap;
assert_eq!;