napi-rs/napi/src/task.rs

12 lines
285 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>;
fn resolve(&self, env: &mut Env, output: Self::Output) -> Result<Self::JsValue>;
}