napi-rs/examples/napi/src/lib.rs

57 lines
960 B
Rust
Raw Normal View History

#![allow(dead_code)]
2022-03-13 19:28:41 +09:00
#![allow(unreachable_code)]
#![allow(clippy::disallowed_names)]
#![allow(clippy::uninlined_format_args)]
use napi::{Env, JsUnknown};
#[macro_use]
extern crate napi_derive;
2021-09-24 18:01:54 +09:00
#[macro_use]
extern crate serde_derive;
2022-12-09 19:56:50 +09:00
#[cfg(feature = "snmalloc")]
#[global_allocator]
static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
#[napi]
/// This is a const
pub const DEFAULT_COST: u32 = 12;
2021-12-19 21:17:54 +09:00
#[napi(skip_typescript)]
pub const TYPE_SKIPPED_CONST: u32 = 12;
mod array;
2021-10-25 01:00:31 +09:00
mod r#async;
2021-11-11 01:33:51 +09:00
mod bigint;
mod callback;
mod class;
mod class_factory;
mod date;
2021-11-02 01:34:19 +09:00
mod either;
mod r#enum;
2021-09-24 10:46:27 +09:00
mod error;
2021-11-21 17:11:15 +09:00
mod external;
mod fn_strict;
mod fn_ts_override;
mod generator;
mod js_mod;
mod map;
mod nullable;
mod number;
mod object;
mod promise;
mod reference;
2021-09-28 01:01:19 +09:00
mod serde;
mod shared;
mod string;
2021-11-16 00:09:44 +09:00
mod symbol;
2021-11-02 21:36:34 +09:00
mod task;
mod threadsafe_function;
2021-10-08 22:13:27 +09:00
mod typed_array;
#[napi]
pub fn run_script(env: Env, script: String) -> napi::Result<JsUnknown> {
env.run_script(script)
}