From dda0f1c343bfb3196ce6a7c7e8c2acccfd5c2e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 22 Jun 2023 23:37:56 +0200 Subject: 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. --- ext/net/ops_unix.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/net/ops_unix.rs') diff --git a/ext/net/ops_unix.rs b/ext/net/ops_unix.rs index bed923f8b..f3ff9617a 100644 --- a/ext/net/ops_unix.rs +++ b/ext/net/ops_unix.rs @@ -9,11 +9,11 @@ use deno_core::op; use deno_core::AsyncRefCell; use deno_core::CancelHandle; use deno_core::CancelTryFuture; +use deno_core::JsBuffer; use deno_core::OpState; use deno_core::RcRef; use deno_core::Resource; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use serde::Deserialize; use serde::Serialize; use std::borrow::Cow; @@ -138,7 +138,7 @@ where pub async fn op_net_recv_unixpacket( state: Rc>, rid: ResourceId, - mut buf: ZeroCopyBuf, + mut buf: JsBuffer, ) -> Result<(usize, Option), AnyError> { let resource = state .borrow() @@ -160,7 +160,7 @@ async fn op_net_send_unixpacket( state: Rc>, rid: ResourceId, path: String, - zero_copy: ZeroCopyBuf, + zero_copy: JsBuffer, ) -> Result where NP: NetPermissions + 'static, -- cgit v1.2.3