Trait napi::Task[][src]

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

Associated Types

Required methods

fn compute(&mut self) -> Result<Self::Output>[src]

Compute logic in libuv thread

fn resolve(self, env: Env, output: Self::Output) -> Result<Self::JsValue>[src]

Into this method if compute return Ok

Provided methods

fn reject(self, _env: Env, err: Error) -> Result<Self::JsValue>[src]

Into this method if compute return Err

Implementors