From 46b1c653c0c433932908b7610f60b409af134c76 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Mon, 12 Apr 2021 21:55:05 +0200 Subject: refactor(deno): remove concept of bin & json ops (#10145) --- core/ops_json.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'core/ops_json.rs') diff --git a/core/ops_json.rs b/core/ops_json.rs index 3e2b532d0..cf2e6230b 100644 --- a/core/ops_json.rs +++ b/core/ops_json.rs @@ -25,18 +25,18 @@ use std::rc::Rc; /// When registering an op like this... /// ```ignore /// let mut runtime = JsRuntime::new(...); -/// runtime.register_op("hello", deno_core::json_op_sync(Self::hello_op)); +/// runtime.register_op("hello", deno_core::op_sync(Self::hello_op)); /// ``` /// /// ...it can be invoked from JS using the provided name, for example: /// ```js /// Deno.core.ops(); -/// let result = Deno.core.jsonOpSync("function_name", args); +/// let result = Deno.core.opSync("function_name", args); /// ``` /// /// The `Deno.core.ops()` statement is needed once before any op calls, for initialization. /// A more complete example is available in the examples directory. -pub fn json_op_sync(op_fn: F) -> Box +pub fn op_sync(op_fn: F) -> Box where F: Fn(&mut OpState, V, Option) -> Result + 'static, V: DeserializeOwned, @@ -63,18 +63,18 @@ where /// When registering an op like this... /// ```ignore /// let mut runtime = JsRuntime::new(...); -/// runtime.register_op("hello", deno_core::json_op_async(Self::hello_op)); +/// runtime.register_op("hello", deno_core::op_async(Self::hello_op)); /// ``` /// /// ...it can be invoked from JS using the provided name, for example: /// ```js /// Deno.core.ops(); -/// let future = Deno.core.jsonOpAsync("function_name", args); +/// let future = Deno.core.opAsync("function_name", args); /// ``` /// /// The `Deno.core.ops()` statement is needed once before any op calls, for initialization. /// A more complete example is available in the examples directory. -pub fn json_op_async(op_fn: F) -> Box +pub fn op_async(op_fn: F) -> Box where F: Fn(Rc>, V, Option) -> R + 'static, V: DeserializeOwned, @@ -115,7 +115,7 @@ mod tests { use super::*; #[tokio::test] - async fn json_op_async_stack_trace() { + async fn op_async_stack_trace() { let mut runtime = crate::JsRuntime::new(Default::default()); async fn op_throw( @@ -128,7 +128,7 @@ mod tests { Err(crate::error::generic_error("foo")) } - runtime.register_op("op_throw", json_op_async(op_throw)); + runtime.register_op("op_throw", op_async(op_throw)); runtime .execute( "", @@ -139,7 +139,7 @@ mod tests { Deno.core.registerErrorClass('Error', Error); async function f1() { - await Deno.core.jsonOpAsync('op_throw', 'hello'); + await Deno.core.opAsync('op_throw', 'hello'); } async function f2() { -- cgit v1.2.3