summaryrefslogtreecommitdiff
path: root/core/ops.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/ops.rs')
-rw-r--r--core/ops.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/ops.rs b/core/ops.rs
index caf984e00..53aec4ae4 100644
--- a/core/ops.rs
+++ b/core/ops.rs
@@ -21,7 +21,7 @@ use std::pin::Pin;
use std::rc::Rc;
pub type PromiseId = u64;
-pub type OpAsyncFuture = Pin<Box<dyn Future<Output = OpResponse>>>;
+pub type OpAsyncFuture = Pin<Box<dyn Future<Output = (PromiseId, OpResponse)>>>;
pub type OpFn =
dyn Fn(Rc<RefCell<OpState>>, OpPayload, Option<ZeroCopyBuf>) -> Op + 'static;
pub type OpId = usize;
@@ -29,16 +29,19 @@ pub type OpId = usize;
pub struct OpPayload<'a, 'b, 'c> {
pub(crate) scope: Option<&'a mut v8::HandleScope<'b>>,
pub(crate) value: Option<v8::Local<'c, v8::Value>>,
+ pub(crate) promise_id: PromiseId,
}
impl<'a, 'b, 'c> OpPayload<'a, 'b, 'c> {
pub fn new(
scope: &'a mut v8::HandleScope<'b>,
value: v8::Local<'c, v8::Value>,
+ promise_id: PromiseId,
) -> Self {
Self {
scope: Some(scope),
value: Some(value),
+ promise_id,
}
}
@@ -46,6 +49,7 @@ impl<'a, 'b, 'c> OpPayload<'a, 'b, 'c> {
Self {
scope: None,
value: None,
+ promise_id: 0,
}
}