Re-exports§
pub use crate::napi::Env;pub use crate::napi::js_values::TypedArrayType;pub use crate::napi::JsFunction;pub use crate::napi::js_values::JsUnknown as Unknown;pub use crate::napi::JsDate as Date;pub use self::js_values::*;
Modules§
Structs§
- Abort
Signal - https://developer.mozilla.org/zh-CN/docs/Web/API/AbortController
- Array
- Async
Cleanup Hook - Notice
The hook will be removed if
AsyncCleanupHookwasdropped. If you want keep the hook until node process exited, call theAsyncCleanupHook::forget. - Async
Task - Async
Work Promise - BigInt
- https://nodejs.org/api/n-api.html#napi_create_bigint_words The resulting BigInt is calculated as: (–1)^sign_bit (words[0] × (2^64)^0 + words[1] × (2^64)^1 + …)
- BigInt64
Array - BigUint64
Array - Buffer
- Zero copy u8 vector shared between rust and napi.
It’s designed to be used in
asynccontext, so it contains overhead to ensure the underlying data is not dropped. For non-async context, useBufferRefinstead. - Buffer
Slice - Zero copy buffer slice shared between Rust and Node.js.
It can only be used in non-async context and the lifetime is bound to the fn closure.
If you want to use Node.js Buffer in async context or want to extend the lifetime, use
Bufferinstead. - Call
Context - Function call context
- Class
Instance - Cleanup
EnvHook - Created by
Env::add_env_cleanup_hookAnd used byEnv::remove_env_cleanup_hook - Env
Envis used to represent a context that the underlying N-API implementation can use to persist VM-specific state.- Error
- Represent
JsError. Return this Error injs_function, napi-rs will throw it asJsErrorfor you. If you want throw it asTypeErrororRangeError, you can useJsTypeError/JsRangeError::from(Error).throw_into(env) - Extended
Error Info - External
- Float32
Array - Float64
Array - Function
- A JavaScript function.
It can only live in the scope of a function call.
If you want to use it outside the scope of a function call, you can turn it into a reference.
By calling the
create_refmethod. - Function
Ref - A reference to a JavaScript function. It can be used to outlive the scope of the function.
- Int8
Array - Int16
Array - Int32
Array - JsError
- JsRange
Error - JsRc
- JsSyntax
Error - JsType
Error - Node
Version - Null
- Reference
- Experimental feature
- Shared
Reference - Experimental feature
- Symbol
- Uint8
Array - Uint8
Clamped Array - Uint8
Clamped Slice - Zero copy Uint8ClampedArray slice shared between Rust and Node.js.
It can only be used in non-async context and the lifetime is bound to the fn closure.
If you want to use Node.js
Uint8ClampedArrayin async context or want to extend the lifetime, useUint8ClampedArrayinstead. - Uint16
Array - Uint32
Array - Utf16
String - Weak
Reference - i64n
- i64 is converted to
Number
Enums§
- Either
- Either3
- Either4
- Either5
- Either6
- Either7
- Either8
- Either9
- Either10
- Either11
- Either12
- Either13
- Either14
- Either15
- Either16
- Either17
- Either18
- Either19
- Either20
- Either21
- Either22
- Either23
- Either24
- Either25
- Either26
- Status
- Value
Type
Traits§
- From
Napi MutRef - From
Napi Ref - From
Napi Value - Generator
- Implement a Iterator for the JavaScript Class. This feature is an experimental feature and is not yet stable.
- JsRcExt
- JsValues
Tuple Into Vec - Object
Finalize - Task
- ToNapi
Value - Type
Name - Validate
Napi Value
Functions§
- create_
promise - get_
c_ callback - Get
C Callbackfrom defined Rustfn - get_
js_ function - Get
JsFunctionfrom defined Rustfn - napi_
register_ ⚠module_ v1 - Register the n-api module exports.
- noop_
finalize - This function could be used for
create_buffer_with_borrowed_dataand want do noting when Buffer finalized. - spawn_
local - spawn_
local_ promise
Type Aliases§
- Callback
- Contextless
Result - Export
Register Callback - Module
Exports Callback - Object
- Promise
Executor - Result
- This
- Undefined