napi-rs / Napi
Licence: mit
High-level Node.js N-API bindings for Rust [WIP] β¨π¦πβ¨
Stars: β 85
Programming Languages
rust
11053 projects
Projects that are alternatives of or similar to Napi
V8pp
Bind C++ functions and classes into V8 JavaScript engine
Stars: β 643 (+656.47%)
Mutual labels: addons
Addon Wireguard
WireGuard - Home Assistant Community Add-ons
Stars: β 72 (-15.29%)
Mutual labels: addons
Squashed Merge Message
Use Pull Request description as Squashed and Merged commit messages.
Stars: β 34 (-60%)
Mutual labels: addons
Addon Zwave2mqtt
Z-Wave to MQTT - Home Assistant Community Add-ons
Stars: β 58 (-31.76%)
Mutual labels: addons
Ramda Adjunct
Ramda Adjunct is the most popular and most comprehensive set of functional utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
Stars: β 550 (+547.06%)
Mutual labels: addons
Lodepng Rust
All-in-one PNG image encoder/decoder in pure Rust
Stars: β 78 (-8.24%)
Mutual labels: rust-bindings
Stripe Rs
Moved to https://github.com/wyyerd/stripe-rs.
Stars: β 16 (-81.18%)
Mutual labels: rust-bindings
Playwright Addons
Add-ons for Playwright: adblocker, stealth mode
Stars: β 32 (-62.35%)
Mutual labels: addons
Addon Adb
Android Debug Bridge - Home Assistant Community Add-ons
Stars: β 58 (-31.76%)
Mutual labels: addons
Gutenberg Parser Rs
An experimental Rust parser for WordPress Gutenberg post format
Stars: β 76 (-10.59%)
Mutual labels: rust-bindings
Minecraftdeveloperguide
πMinecraft developer Chinese guideοΌζηδΈηεΌεθ
δΈζζε
Stars: β 574 (+575.29%)
Mutual labels: addons
Nestjs Dialogflow
Dialog flow module that simplify the web hook handling for your NLP application using NestJS π‘
Stars: β 51 (-40%)
Mutual labels: addons
Rust Onig
Rust bindings for the Oniguruma regex library
Stars: β 81 (-4.71%)
Mutual labels: rust-bindings
Rusted Switch
Nintendo Switch Homebrew with Rust π¦
Stars: β 75 (-11.76%)
Mutual labels: rust-bindings
Addon Spotify Connect
Spotify Connect - Home Assistant Community Add-ons
Stars: β 60 (-29.41%)
Mutual labels: addons
Node.js N-API for Rust! [work in progress]
High-level N-API bindings for Node.js addons written in Rust.
Warning: this is a proof-of-concept implementation that's not intended for use yet. The project is under initial phase of development, the API is a quite sketchy and is going to be refactored heavily. If you are interested in contributing, though, it is super welcome!
The project is covered by a Code of Conduct.
Crates
-
napi-sys
: low-level bindings to N-API generated fromnode_api.h
usingbindgen
. -
napi
: high-level and rusty wrappers aroundnapi-sys
. -
napi-derive
: contains a procedural macro that allows to construct typesafe structures that represent N-API callback parameters and automatically validate the arguments that JavaScript code passes in.
Example
Check out the example
directory to see the full source code and
project structure of this example. (TODO: initialize the module from Rust too).
lib.rs
#[macro_use]
extern crate napi;
#[macro_use]
extern crate napi_derive;
use napi::{NapiEnv, NapiNumber, NapiResult, NapiUndefined};
#[derive(NapiArgs)]
struct HelloArgs;
fn hello<'a>(env: &'a NapiEnv, _: &HelloArgs) -> NapiResult<NapiUndefined<'a>> {
println!("Hello from the Rust land!");
NapiUndefined::new(env)
}
#[derive(NapiArgs)]
struct AddArgs<'a> {
first: NapiNumber<'a>,
second: NapiNumber<'a>,
}
fn add<'a>(env: &'a NapiEnv, args: &AddArgs<'a>) -> NapiResult<NapiNumber<'a>> {
let first = args.first.to_i32()?;
let second = args.second.to_i32()?;
NapiNumber::from_i32(env, first + second)
}
napi_callback!(example_hello, hello);
napi_callback!(example_add, add);
example.js
'use strict';
const addon = require('./build/Release/example.node');
addon.hello();
console.log(addon.add(1, 2));
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].