For some reason, I can't use JsBox. I am using the 0.8.2 crate I get the flowing error
unresolved import neon::types::JsBox
For some reason, I can't use JsBox. I am using the 0.8.2 crate I get the flowing error
unresolved import neon::types::JsBox
According to this, neon::types::JsBox
seems to be only available with the new N-API backend. You can find a migration guide here. This is probably the most relevant part:
Enabling the N-API backend
To enable the N-API backend, you need to:
- Remove
build.rs
from the project directory andbuild = "build.rs"
from theCargo.toml
. The N-API backend does not require a Cargo build script.- Disable the default features (for now, the default features select the legacy > backend) by setting
default-features = false
; and- Enable the appropriate feature flag in your
Cargo.toml
to select the N-API version you need support for (each N-API version N uses the feature flag"napi-N"
, for example"napi-4"
for N-API version 4).As a rule, you should choose the oldest version of N-API that has the APIs you need. (We will be adding N-API version requirements to the Neon API docs to make this clearer in the future.) You can consult the official N-API feature matrix to see which N-API versions come with various versions of Node.
[dependencies.neon] version = "0.8.2" default-features = false features = ["napi-4"]