Zero copy u8 vector shared between rust and napi.
It’s designed to be used in async context, so it contains overhead to ensure the underlying data is not dropped.
For non-async context, use BufferRef instead.
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 Buffer instead.
Represent JsError.
Return this Error in js_function, napi-rs will throw it as JsError for you.
If you want throw it as TypeError or RangeError, you can use JsTypeError/JsRangeError::from(Error).throw_into(env)
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_ref method.
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 Uint8ClampedArray in async context or want to extend the lifetime, use Uint8ClampedArray instead.
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.
If the feature tokio_rt has been enabled this will enter the runtime context and
then call the provided closure. Otherwise it will just call the provided closure.
Marks a function or static variable as a library/executable constructor.
This uses OS-specific linker sections to call a specific function at
load time.