napi-rs Docs

napi

napi

napi@1.7.5

Perf

  • perf(napi): reduce tokio future execution overhead #597

napi@1.7.4

Chore

  • chore(napi): remove useless build dependencies

napi@1.7.3

Bugfix

  • fix(napi): JsString* leak in from_js_value #584

napi@1.7.2

Bugfix

  • Allow dropping of string&buffer values when converting #582

napi@1.7.1

Bugfix

  • fix(napi): wrong memory location of data in future resolved callback #579

napi@1.7.0

Feature

  • feat(napi): impl more types AsRef and AsMut for TypedArray #578

Refactor

  • refactor(napi): change more generic constraint from NapiValue => NapiRaw #565

napi-sys@1.1.1

Fix

  • fix(sys): napi_bigint64_array and napi_biguint64_array should be behind the napi6 feature flag

napi@1.6.1

Chore

  • chore(napi): upgrade once_cell

napi@1.6.0

Feature

napi8 feature added into napi crate.

Chore

  • Node.js@10 and Node.js@15 removed from CI.

napi@1.5.0

Feature

  • feat(napi): expose create_string_from_c_char for C ffi scenario d1bcecc

Fix

  • fix(napi): memory ordering issues in tsfn 5a21bbe

napi@1.4.0

Feature

  • refactor(napi): split NapiRaw trait from NapiValue #524

napi@1.3.4

Bugfix

  • fix(napi): do not call release tsfn in Drop when ref count is 0 #522

napi@1.3.3

Bugfix

  • fix(napi): finalizer maybe_ref pointer value f45f1ae
  • Add a way to convert stateful (Rust) closures into JsFunction 4aba159

Docs

  • Remove deprecated register_module from example in README.md 5527451

napi@1.3.2

Bugfix

  • fix(napi): napi_adjust_external_memory issue on wini686. 1e3290c

napi@1.3.1

Bugfix

  • fix(napi): InvalidArg error when create_external with size hint. 50f207f

napi@1.3.0

Feature

  • Add a way to opt out of error handling for ThreadsafeFunction #500

napi@1.2.0

Feature

  • feat(napi): unwrap &'static value from Ref object e622d96
  • feat(napi): add back clone trait to ThreadsafeFunction 071dcff

Chore

  • chore(napi): relax the tokio version from 1.1 to 1. c39b364

napi@1.1.3

Chore

  • chore(napi): upgrade tokio to 1.1 2775b47

napi@1.1.2

Bugfix

  • fix(napi): throw JavaScript error in tsfn rather than rust thread panic f46aa1f

napi@1.1.1

Feature

  • Implement Copy and Clone trait for JavaScript Primitive types. c121537

Bugfix

  • Remove unexpected into_*_ref from JsString. e24738a

napi@1.1.0

Feature

  • Implement Env::create_arraybuffer_with_borrowed_data for ffi scenario. 911a0c1

napi@1.0.1

Bugfix

  • enable napi4 feature when tokio_rt enabled.
  • Remove unexpected napi_acquire_threadsafe_function in Env::execute_tokio_future which would prevent Node.js process to exit: #397

napi@1.0.0

Breaking changes

Module register

The old way:

register_module!(test_module, init);
fn init(module: &mut Module) -> Result<()> {
// ....
Ok(())
}

The new way:

#[module_exports]
fn init(mut exports: JsObject) -> Result<()> {
// ...
Ok(())
}

or

#[module_exports]
fn init(mut exports: JsObject, env: Env) -> Result<()> {
// ...
Ok(())
}

Task

- pub trait Task: Send {
+ pub trait Task: Send + Sized {
type Output: Send + Sized + 'static;
type JsValue: NapiValue;
- fn compute(&self) -> Result<Self::Output>;
+ fn compute(&mut self) -> Result<Self::Output>;
- fn resolve(&self, env: &mut Env, output: Self::Output) -> Result<Self::JsValue>;
+ fn resolve(self, env: Env, output: Self::Output) -> Result<Self::JsValue>;
+ fn reject(self, _env: Env, err: Error) -> Result<Self::JsValue> {
+ Err(err)
+ }
}
Edit this page on GitHub