2020-09-30 15:34:26 +09:00
|
|
|
#[macro_use]
|
|
|
|
extern crate napi_derive;
|
|
|
|
|
2020-11-25 18:42:14 +09:00
|
|
|
use napi::{JsObject, Result};
|
2020-09-30 15:34:26 +09:00
|
|
|
|
2020-12-21 17:10:30 +09:00
|
|
|
#[cfg(all(unix, not(target_env = "musl"), not(target_arch = "aarch64")))]
|
|
|
|
#[global_allocator]
|
|
|
|
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
#[global_allocator]
|
|
|
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
|
|
|
|
2020-09-30 15:34:26 +09:00
|
|
|
mod async_compute;
|
2020-12-21 17:10:30 +09:00
|
|
|
mod buffer;
|
2020-09-30 15:34:26 +09:00
|
|
|
mod noop;
|
|
|
|
mod plus;
|
|
|
|
|
2020-11-25 18:42:14 +09:00
|
|
|
#[module_exports]
|
|
|
|
fn init(mut exports: JsObject) -> Result<()> {
|
|
|
|
exports.create_named_method("noop", noop::noop)?;
|
2020-09-30 15:34:26 +09:00
|
|
|
|
2020-11-25 18:42:14 +09:00
|
|
|
async_compute::register_js(&mut exports)?;
|
2020-12-21 17:10:30 +09:00
|
|
|
buffer::register_js(&mut exports)?;
|
2020-11-25 18:42:14 +09:00
|
|
|
plus::register_js(&mut exports)?;
|
2020-09-30 15:34:26 +09:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|