napi-rs/napi/src/task.rs

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