Re-exports§
pub use crate::error;pub use crate::JsError;pub use crate::JsValue;pub use crate::Property;pub use crate::PropertyAttributes;pub use crate::Result;pub use crate::Status;pub use crate::Task;pub use crate::ValueType;pub use crate::Env;pub use crate::JsDate as Date;pub use crate::JsFunction;Deprecated pub use crate::sys;pub use ::tracing;
Modules§
Structs§
- Abort
Signal - https://developer.mozilla.org/zh-CN/docs/Web/API/AbortController
- Array
- Array
Buffer - Represents a JavaScript ArrayBuffer
- Async
Block - Async
Block Builder - Async
Task - 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 - BigInt64
Array Slice - BigUint64
Array - BigUint64
Array Slice - 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, useBufferSliceinstead. - Buffer
Slice - Zero copy buffer slice shared between Rust and Node.js.
- Callback
Context - Class
Instance - 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) - Escapable
Handle Scope - Extended
Error Info - External
- External
Ref ExternalRefis a reference to anExternalobject- Finalize
Context - Float32
Array - Float32
Array Slice - Float64
Array - Float64
Array Slice - FnArgs
- 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
Call Context - Function
Ref - A reference to a JavaScript function. It can be used to outlive the scope of the function.
- Handle
Scope - Int8
Array - Int8
Array Slice - Int16
Array - Int16
Array Slice - Int32
Array - Int32
Array Slice - Iterator
Value - JsError
- JsRange
Error - JsSyntax
Error - JsType
Error - Latin1
String - Null
- Object
- Object
Ref - A reference to a JavaScript object.
- Promise
- The JavaScript Promise object representation
- Promise
Raw - RawC
String - A wrapper around the raw c_char pointer to a C string.
- Readable
Stream - Reader
- Reference
- Create a
napi_reffromClassinstance. - Shared
Reference - Experimental feature
- Symbol
- This
- Threadsafe
Function Builder - Typed
Array - Represents a JavaScript ArrayBuffer
- Uint8
Array - Uint8
Array Slice - 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 - Uint16
Array Slice - Uint32
Array - Uint32
Array Slice - Unknown
- Represents a raw JavaScript value
- Utf16
String - Weak
Reference - Writeable
Stream - 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
- KeyCollection
Mode - KeyConversion
- KeyFilter
- Typed
Array Type
Constants§
Statics§
Traits§
- Async
Generator - Implement a Iterator for the JavaScript Class. This feature is an experimental feature and is not yet stable.
- 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.
- Java
Script Class Ext - JsObject
Value - JsValues
Tuple - JsValues
Tuple Into Vec - Object
Finalize - ToNapi
Value - Tuple
From Slice Values - Type
Name - Validate
Napi Value
Functions§
- block_
on - Runs a future to completion This is blocking, meaning that it pauses other execution until the future is complete, only use it when it is absolutely necessary, in other places use async functions instead.
- create_
custom_ tokio_ runtime - execute_
tokio_ future - within_
runtime_ if_ available