2020-06-21 20:10:06 +09:00
|
|
|
use crate::js_values::NapiValue;
|
|
|
|
use crate::{Env, Result};
|
2020-05-11 01:28:06 +09:00
|
|
|
|
2020-08-06 15:52:00 +09:00
|
|
|
pub trait Task: Send {
|
2020-05-12 14:59:20 +09:00
|
|
|
type Output: Send + Sized + 'static;
|
2020-06-21 20:10:06 +09:00
|
|
|
type JsValue: NapiValue;
|
2020-05-11 01:28:06 +09:00
|
|
|
|
2020-06-19 17:19:06 +09:00
|
|
|
fn compute(&mut self) -> Result<Self::Output>;
|
2020-05-11 01:28:06 +09:00
|
|
|
|
2020-06-21 20:10:06 +09:00
|
|
|
fn resolve(&self, env: &mut Env, output: Self::Output) -> Result<Self::JsValue>;
|
2020-05-11 01:28:06 +09:00
|
|
|
}
|