diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-06-22 23:37:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-22 23:37:56 +0200 |
commit | dda0f1c343bfb3196ce6a7c7e8c2acccfd5c2e5b (patch) | |
tree | 10fc273a620949ccf63826363499f8f39056896d /core/examples/http_bench_json_ops/main.rs | |
parent | b319fa7f4965af3d3d576ea528248a31c96a4053 (diff) |
refactor(serde_v8): split ZeroCopyBuf into JsBuffer and ToJsBuffer (#19566)
`ZeroCopyBuf` was convenient to use, but sometimes it did hide details
that some copies were necessary in certain cases. Also it made it way to easy
for the caller to pass around and convert into different values. This commit
splits `ZeroCopyBuf` into `JsBuffer` (an array buffer coming from V8) and
`ToJsBuffer` (a Rust buffer that will be converted into a V8 array buffer).
As a result some magical conversions were removed (they were never used)
limiting the API surface and preparing for changes in #19534.
Diffstat (limited to 'core/examples/http_bench_json_ops/main.rs')
-rw-r--r-- | core/examples/http_bench_json_ops/main.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/examples/http_bench_json_ops/main.rs b/core/examples/http_bench_json_ops/main.rs index 36c0996c3..a4d6afe31 100644 --- a/core/examples/http_bench_json_ops/main.rs +++ b/core/examples/http_bench_json_ops/main.rs @@ -3,11 +3,11 @@ use deno_core::anyhow::Error; use deno_core::op; use deno_core::AsyncRefCell; use deno_core::AsyncResult; +use deno_core::JsBuffer; use deno_core::JsRuntimeForSnapshot; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use std::cell::RefCell; use std::env; use std::net::SocketAddr; @@ -116,7 +116,7 @@ fn create_js_runtime() -> JsRuntimeForSnapshot { async fn op_read_socket( state: Rc<RefCell<OpState>>, rid: ResourceId, - mut data: ZeroCopyBuf, + mut data: JsBuffer, ) -> Result<u32, Error> { let resource = state.borrow_mut().resource_table.get::<TcpStream>(rid)?; let nread = resource.read(&mut data).await?; |