mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
fix(napi): the generic trait rectiction of Env::spawn should be ScopedTask (#2817)
This commit is contained in:
parent
a40e2368e6
commit
7a26a98ee9
@ -42,9 +42,7 @@ use crate::{
|
||||
bindgen_runtime::JsObjectValue,
|
||||
check_status,
|
||||
js_values::*,
|
||||
sys,
|
||||
task::Task,
|
||||
Error, ExtendedErrorInfo, NodeVersion, Result, Status, ValueType,
|
||||
sys, Error, ExtendedErrorInfo, NodeVersion, Result, ScopedTask, Status, ValueType,
|
||||
};
|
||||
|
||||
pub type Callback = unsafe extern "C" fn(sys::napi_env, sys::napi_callback_info) -> sys::napi_value;
|
||||
@ -1026,7 +1024,10 @@ impl Env {
|
||||
}
|
||||
|
||||
/// Run [Task](./trait.Task.html) in libuv thread pool, return [AsyncWorkPromise](./struct.AsyncWorkPromise.html)
|
||||
pub fn spawn<T: 'static + Task>(&self, task: T) -> Result<AsyncWorkPromise<T::JsValue>> {
|
||||
pub fn spawn<'env, T: 'env + ScopedTask<'env>>(
|
||||
&self,
|
||||
task: T,
|
||||
) -> Result<AsyncWorkPromise<T::JsValue>> {
|
||||
async_work::run(self.0, task, None)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user