diff options
Diffstat (limited to 'core/ops_json.rs')
-rw-r--r-- | core/ops_json.rs | 18 |
1 files changed, 9 insertions, 9 deletions
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<F, V, R>(op_fn: F) -> Box<OpFn> +pub fn op_sync<F, V, R>(op_fn: F) -> Box<OpFn> where F: Fn(&mut OpState, V, Option<ZeroCopyBuf>) -> Result<R, AnyError> + '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<F, V, R, RV>(op_fn: F) -> Box<OpFn> +pub fn op_async<F, V, R, RV>(op_fn: F) -> Box<OpFn> where F: Fn(Rc<RefCell<OpState>>, V, Option<ZeroCopyBuf>) -> 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( "<init>", @@ -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() { |