#[repr(C)]
pub struct NapiEnv(_);

Implementations

create NapiEnv from raw napi_env

access raw napi_env from NapiEnv

This API returns the global object.

get node version the returned buffer is statically allocated and does not need to be freed.

get napi version

Return null object

Return undefined object

This API is used to convert from the C int32_t type to the JavaScript number type. The JavaScript number type is described in Section 6.1.6 of the ECMAScript Language Specification.

This API is used to convert from the C uint32_t type to the JavaScript number type. The JavaScript number type is described in Section 6.1.6 of the ECMAScript Language Specification.

This API is used to convert from the C int64_t type to the JavaScript number type. The JavaScript number type is described in Section 6.1.6 of the ECMAScript Language Specification. Note the complete range of int64_t cannot be represented with full precision in JavaScript. Integer values outside the range of Number.MIN_SAFE_INTEGER -(253 - 1) - Number.MAX_SAFE_INTEGER (253 - 1) will lose precision.

This API is used to convert from the C double type to the JavaScript number type. The JavaScript number type is described in Section 6.1.6 of the ECMAScript Language Specification.

This API creates a JavaScript string value from a UTF8-encoded C string. The native string is copied. The JavaScript string type is described in Section 6.1.4 of the ECMAScript Language Specification.

Create an empty js array.

Create a boolean.

Create a Buffer

Create a Buffer from u8

Create an ArrayBuffer

This API creates a JavaScript symbol value from a UTF8-encoded C string. The JavaScript symbol type is described in Section 19.4 of the ECMAScript Language Specification.

Symbol with description.

This API allocates a default JavaScript Object. It is the equivalent of doing new Object() in JavaScript. The JavaScript Object type is described in Section 6.1.7 of the ECMAScript Language Specification.

The async context

Create an external data.

Create a js function with a rust closure.

Create a named js function with a rust closure.

Create a named js function with a rust function

Create a js function with a rust function

Create a js class with a rust closure

Create an async work with shared state

Create a promise with a work & complete closure.

This method allows the efficient definition of multiple properties on a given object. The properties are defined using property descriptors (see napi_property_descriptor). Given an array of such property descriptors, this API will set the properties on the object one at a time, as defined by DefineOwnProperty() (described in Section 9.1.6 of the ECMA-262 specification).

This API throws a JavaScript Error with the text provided.

This API throws a JavaScript Error with the text provided.

This API throws a JavaScript TypeError with the text provided.

This API throws a JavaScript TypeError with the text provided.

This API throws a JavaScript TypeError with the text provided.

This API throws a JavaScript TypeError with the text provided.

Get and clear last exception This API can be called even if there is a pending JavaScript exception.

This API retrieves a napi_extended_error_info structure with information about the last error that occurred.

The content of the napi_extended_error_info returned is only valid up until a Node-API function is called on the same env. This includes a call to napi_is_exception_pending so it may often be necessary to make a copy of the information so that it can be used later. The pointer returned in error_message points to a statically-defined string so it is safe to use that pointer if you have copied it out of the error_message field (which will be overwritten) before another Node-API function was called.

Do not rely on the content or format of any of the extended information as it is not subject to SemVer and may change at any time. It is intended only for logging purposes.

This API can be called even if there is a pending JavaScript exception.

Return true if an exception is pending. This API can be called even if there is a pending JavaScript exception.

Create a js Error.

Create a handle scope

Create a escapable handle scope

This function gives V8 an indication of the amount of externally allocated memory that is kept alive by JavaScript objects (i.e. a JavaScript object that points to its own memory allocated by a native module). Registering externally allocated memory will trigger global garbage collections more often than it would otherwise.

This function executes a string of JavaScript code and returns its result with the following caveats:

  • Unlike eval, this function does not allow the script to access the current lexical scope, and therefore also does not allow to access the module scope, meaning that pseudo-globals such as require will not be available.
  • The script can access the global scope. Function and var declarations in the script will be added to the global object. Variable declarations made using let and const will be visible globally, but will not be added to the global object.
  • The value of this is global within the script.

Trait Implementations

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.