use crate::napi::bindgen_runtime::ToNapiValue;
use crate::napi::bindgen_runtime::TypeName;
use crate::napi::Env;
use crate::napi::Error;
use crate::napi::Result;
pub trait Task: Send + Sized {
type Output: Send + Sized + 'static;
type JsValue: ToNapiValue + TypeName;
fn compute(&mut self) -> Result<Self::Output>;
fn resolve(
&mut self,
env: Env,
output: Self::Output,
) -> Result<Self::JsValue>;
fn reject(
&mut self,
_env: Env,
err: Error,
) -> Result<Self::JsValue> {
Err(err)
}
fn finally(
&mut self,
_env: Env,
) -> Result<()> {
Ok(())
}
}