A framework for building compiled Node.js add-ons in Rust via Node-API
OTHER License
Bot releases are hidden (Show)
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
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(())
}
- 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)
+ }
}
Published by Brooooooklyn over 3 years ago
ThreadsafeFunction
https://github.com/napi-rs/napi-rs/pull/500
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn over 3 years ago
Published by Brooooooklyn almost 4 years ago
Published by Brooooooklyn almost 4 years ago
Published by Brooooooklyn almost 4 years ago
Env::create_arraybuffer_with_borrowed_data
for FFI
scenario.Published by Brooooooklyn almost 4 years ago
napi4
feature when tokio_rt
enablednapi_acquire_threadsafe_function
in execute_tokio_future
which would prevent NodeJS process to exit: https://github.com/napi-rs/napi-rs/issues/397
Published by Brooooooklyn almost 4 years ago