Neon
  • Docs
  • Examples
  • API
  • Resources
  • Roadmap
  • Help
  • Blog
  • GitHub
NeonFast and Safe Native Node.js Modules

// JS
function hello() {
  let result = fibonacci(10000);
  console.log(result);
  return result;
}

// Neon
fn hello(mut cx: FunctionContext) -> JsResult<JsNumber> {
  let result = cx.number(fibonacci(10000));
  println!("{}", result);
  Ok(result)
}
Try It Out
GitHub
API

Simple Tooling

No makefiles. No fancy global build requirements. Just Node and Rust

Guaranteed Safety

If a neon module compiles, it is guaranteed to be memory safe by the rust compiler

Easy Parallelism

Safely run multiple threads without data races

A Taste


fn make_an_array(mut cx: FunctionContext) -> JsResult<JsArray> {
  // Create some values:
  let n = cx.number(9000);
  let s = cx.string("hello");
  let b = cx.boolean(true);

  // Create a new array:
  let array: Handle<JsArray> = cx.empty_array();

  // Push the values into the array:
  array.set(&mut cx, 0, n)?;
  array.set(&mut cx, 1, s)?;
  array.set(&mut cx, 2, b)?;

  // Return the array:
  Ok(array)
}

register_module!(mut cx, {
  // Export the Rust function as a JS function
  cx.export_function("makeAnArray", make_an_array)
})

A Demo

demo

Get Started!

Neon
Docs
Getting StartedExamplesAPI Reference
Community
User ShowcaseProject ChatTwitter
More
BlogGitHubStar
Copyright © 2019 Neon Bindings