napi-rs/napi/src/task.rs

12 lines
279 B
Rust
Raw Normal View History

use crate::js_values::NapiValue;
use crate::{Env, Result};
2020-08-06 15:52:00 +09:00
pub trait Task: Send {
type Output: Send + Sized + 'static;
type JsValue: NapiValue;
fn compute(&mut self) -> Result<Self::Output>;
2020-09-28 01:27:37 +09:00
fn resolve(self, env: Env, output: Self::Output) -> Result<Self::JsValue>;
}