napi-rs/napi/src/task.rs
2020-08-06 14:53:59 +08:00

11 lines
285 B
Rust

use crate::js_values::NapiValue;
use crate::{Env, Result};
pub trait Task: Send {
type Output: Send + Sized + 'static;
type JsValue: NapiValue;
fn compute(&mut self) -> Result<Self::Output>;
fn resolve(&self, env: &mut Env, output: Self::Output) -> Result<Self::JsValue>;
}