23 releases (4 stable)
1.0.3 | Nov 20, 2024 |
---|---|
1.0.1 | Oct 27, 2024 |
1.0.0-beta.5 | Jul 31, 2024 |
0.0.9 | Mar 1, 2024 |
0.0.1 | Nov 22, 2023 |
#1701 in Procedural macros
3,546 downloads per month
Used in ohos-xcomponent-binding
210KB
6K
SLoC
napi-derive
Checkout more examples in examples folder
#[macro_use]
extern crate napi_derive;
use napi_ohos::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
~0.7–1.2MB
~22K SLoC