From 2aed322dd507a8568b6ee6f4897e9a8e3220f763 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Mon, 5 Apr 2021 18:40:24 +0200 Subject: refactor: convert ops to use serde_v8 (#10009) This commit rewrites most of the ops to use "serde_v8" instead of "json" serialization. --- op_crates/webgpu/shader.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'op_crates/webgpu/shader.rs') diff --git a/op_crates/webgpu/shader.rs b/op_crates/webgpu/shader.rs index 63578ce64..0e653b470 100644 --- a/op_crates/webgpu/shader.rs +++ b/op_crates/webgpu/shader.rs @@ -3,15 +3,13 @@ use deno_core::error::bad_resource_id; use deno_core::error::null_opbuf; use deno_core::error::AnyError; -use deno_core::serde_json::json; -use deno_core::serde_json::Value; use deno_core::ResourceId; use deno_core::ZeroCopyBuf; use deno_core::{OpState, Resource}; use serde::Deserialize; use std::borrow::Cow; -use super::error::WebGpuError; +use super::error::WebGpuResult; pub(crate) struct WebGpuShaderModule(pub(crate) wgpu_core::id::ShaderModuleId); impl Resource for WebGpuShaderModule { @@ -33,7 +31,7 @@ pub fn op_webgpu_create_shader_module( state: &mut OpState, args: CreateShaderModuleArgs, zero_copy: Option, -) -> Result { +) -> Result { let instance = state.borrow::(); let device_resource = state .resource_table @@ -77,8 +75,5 @@ pub fn op_webgpu_create_shader_module( let rid = state.resource_table.add(WebGpuShaderModule(shader_module)); - Ok(json!({ - "rid": rid, - "err": maybe_err.map(WebGpuError::from) - })) + Ok(WebGpuResult::rid_err(rid, maybe_err)) } -- cgit v1.2.3