This crate provides bindings to the Node-API C API, making it easy to write Node native addons in Rust.
Write your native addon in Rust:
```rust node_api::init!(init);
fn init(env: nodeapi::Env, exports: nodeapi::Value) -> Result
fn add(a: u64, b: u64) -> Result
Then load it in Node.js.
javascript
let native = require("./add.node");
assert(native.add(3, 4) === 7);
See the examples folder for a complete example.
To make it easy to move data structures between Rust and Node.js, the node_api crate supports integration with serde.
```rust
struct Contact { name: String, email: String, }
fn contact(env: nodeapi::Env) -> nodeapi::Result
javascript
let contact = native.contact();
console.log("Contact name: " + contact.name);
console.log("Contact email: " + contact.email);