napi-rs/examples/napi/src/promise.rs

8 lines
137 B
Rust
Raw Normal View History

use napi::bindgen_prelude::*;
#[napi]
pub async fn async_plus_100(p: Promise<u32>) -> Result<u32> {
let v = p.await?;
Ok(v + 100)
}