napi-rs/napi/src/task.rs

11 lines
271 B
Rust
Raw Normal View History

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