docs.rs failed to build napi-ohos-1.1.6
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
ohos-rs
This project is forked from napi-rs, many thank to @Brooooooklyn.
MSRV
1.88.0
Taste
You can use ohrs to start a new project.
Define ArkTS function
use *;
use napi;
/// module registration is done by the runtime, no need to explicitly do it now.
/// use `Fn`, `FnMut` or `FnOnce` traits to defined JavaScript callbacks
/// the return type of callbacks can only be `Result`.
/// or, define the callback signature in where clause
/// async fn, require `async` feature enabled.
/// [dependencies]
/// napi = {version="2", features=["async"]}
pub async
Building
Before build, we must setup some environments. You can follow the document to setup them.
Then you can use ohrs to build it directly.
# build single arch
Finally you can copy the dist folder into your OpenHarmony/HarmonyNext project and use it.
Asynchronous runtime
We use tokio as the default asynchronous runtime. But for some simple scenarios, we don't need so complete runtime, and you can try ohos-ffrt.
Discussion
Feel free to join our WeChat group!