diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-04-04 01:17:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 01:17:02 +0200 |
commit | 19d0e6b6710a61e6fdcf9f08e6057e49b349fe18 (patch) | |
tree | 8f444a1e26de1f483972f489e38d67ffc4775b3b /core | |
parent | 878599ca7c4eb7636b6d025e669b39651f5ba1d0 (diff) |
perf(serde_v8): introduce Serializable boxable object (#9983)
Diffstat (limited to 'core')
-rw-r--r-- | core/Cargo.toml | 1 | ||||
-rw-r--r-- | core/bindings.rs | 2 | ||||
-rw-r--r-- | core/lib.rs | 1 | ||||
-rw-r--r-- | core/ops.rs | 3 | ||||
-rw-r--r-- | core/runtime.rs | 2 |
5 files changed, 3 insertions, 6 deletions
diff --git a/core/Cargo.toml b/core/Cargo.toml index 1e23f788e..a06e1e43f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -14,7 +14,6 @@ path = "lib.rs" [dependencies] anyhow = "1.0.38" -erased-serde = "0.3.13" futures = "0.3.12" indexmap = "1.6.1" lazy_static = "1.4.0" diff --git a/core/bindings.rs b/core/bindings.rs index 3484d3cbd..f086e1f9c 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -438,7 +438,7 @@ fn send<'s>( match op { Op::Sync(resp) => match resp { OpResponse::Value(v) => { - rv.set(to_v8(scope, v).unwrap()); + rv.set(v.to_v8(scope).unwrap()); } OpResponse::Buffer(buf) => { rv.set(boxed_slice_to_uint8array(scope, buf).into()); diff --git a/core/lib.rs b/core/lib.rs index 3ee08689e..f51411083 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -65,7 +65,6 @@ pub use crate::ops::OpResponse; pub use crate::ops::OpState; pub use crate::ops::OpTable; pub use crate::ops::PromiseId; -pub use crate::ops::Serializable; pub use crate::ops_bin::bin_op_async; pub use crate::ops_bin::bin_op_sync; pub use crate::ops_bin::ValueOrVector; diff --git a/core/ops.rs b/core/ops.rs index 5bd0928b6..1a2a2ebc7 100644 --- a/core/ops.rs +++ b/core/ops.rs @@ -22,7 +22,6 @@ use std::ops::DerefMut; use std::pin::Pin; use std::rc::Rc; -pub use erased_serde::Serialize as Serializable; pub type PromiseId = u64; pub type OpAsyncFuture = Pin<Box<dyn Future<Output = OpResponse>>>; pub type OpFn = @@ -60,7 +59,7 @@ impl<'a, 'b, 'c> OpPayload<'a, 'b, 'c> { } pub enum OpResponse { - Value(Box<dyn Serializable>), + Value(Box<dyn serde_v8::Serializable>), Buffer(Box<[u8]>), } diff --git a/core/runtime.rs b/core/runtime.rs index a64a71449..f358cf05e 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1419,7 +1419,7 @@ impl JsRuntime { let (promise_id, resp) = overflown_response; args.push(v8::Integer::new(scope, promise_id as i32).into()); args.push(match resp { - OpResponse::Value(value) => serde_v8::to_v8(scope, value).unwrap(), + OpResponse::Value(value) => value.to_v8(scope).unwrap(), OpResponse::Buffer(buf) => { bindings::boxed_slice_to_uint8array(scope, buf).into() } |