23 releases (5 stable)

new 2.0.0-alpha.9 Nov 26, 2021
2.0.0-alpha.1 Oct 31, 2021
1.1.2 Nov 15, 2021
1.1.0 Apr 1, 2021
0.1.0 Nov 30, 2017

#12 in Procedural macros

Download history 6958/week @ 2021-08-09 6351/week @ 2021-08-16 7386/week @ 2021-08-23 7253/week @ 2021-08-30 4776/week @ 2021-09-06 5936/week @ 2021-09-13 7043/week @ 2021-09-20 6051/week @ 2021-09-27 15055/week @ 2021-10-04 40982/week @ 2021-10-11 43649/week @ 2021-10-18 37017/week @ 2021-10-25 37055/week @ 2021-11-01 30026/week @ 2021-11-08 33436/week @ 2021-11-15 33360/week @ 2021-11-22

96,160 downloads per month
Used in 2 crates

MIT license

50KB
1.5K SLoC

napi-derive

chat

Checkout more examples in examples folder

#[macro_use]
extern crate napi_derive;
use napi::bindgen_prelude::*;

#[napi]
fn fibonacci(n: u32) -> u32 {
  match n {
    1 | 2 => 1,
    _ => fibonacci_native(n - 1) + fibonacci_native(n - 2),
  }
}

#[napi]
fn get_cwd<T: Fn(String) -> Result<()>>(callback: T) {
  callback(env::current_dir().unwrap().to_string_lossy().to_string()).unwrap();
}

Dependencies

~295–710KB
~18K SLoC