diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-04-11 07:05:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-11 07:05:43 +0200 |
commit | 29eca72fea4f1e160a8d76d2ebda26e2c48b9658 (patch) | |
tree | be8db9d2253a1f64bda23a01b035932b6dc5d34b /core/bindings.rs | |
parent | 8aa0d5f96ed418e21efb99967f1f6b7fea0dc87f (diff) |
core: avoid async op future reboxing to bundle PromiseId (#10123)
Diffstat (limited to 'core/bindings.rs')
-rw-r--r-- | core/bindings.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/core/bindings.rs b/core/bindings.rs index f086e1f9c..eaddcbfbc 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -9,7 +9,6 @@ use crate::OpResponse; use crate::OpTable; use crate::PromiseId; use crate::ZeroCopyBuf; -use futures::future::FutureExt; use rusty_v8 as v8; use serde::Serialize; use serde_v8::to_v8; @@ -433,7 +432,7 @@ fn send<'s>( } }; - let payload = OpPayload::new(scope, v); + let payload = OpPayload::new(scope, v, promise_id); let op = OpTable::route_op(op_id, state.op_state.clone(), payload, buf); match op { Op::Sync(resp) => match resp { @@ -445,13 +444,11 @@ fn send<'s>( } }, Op::Async(fut) => { - let fut2 = fut.map(move |resp| (promise_id, resp)); - state.pending_ops.push(fut2.boxed_local()); + state.pending_ops.push(fut); state.have_unpolled_ops = true; } Op::AsyncUnref(fut) => { - let fut2 = fut.map(move |resp| (promise_id, resp)); - state.pending_unref_ops.push(fut2.boxed_local()); + state.pending_unref_ops.push(fut); state.have_unpolled_ops = true; } Op::NotFound => { |