From 4d2b9cd37af2b9d6a145a04fc93117922e43df3a Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 18 Apr 2020 20:05:13 -0400 Subject: Fix Op definitions (#4814) --- cli/ops/dispatch_json.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cli/ops/dispatch_json.rs') diff --git a/cli/ops/dispatch_json.rs b/cli/ops/dispatch_json.rs index 70498eb8f..b1a7bc723 100644 --- a/cli/ops/dispatch_json.rs +++ b/cli/ops/dispatch_json.rs @@ -41,7 +41,7 @@ struct AsyncArgs { promise_id: Option, } -pub fn json_op(d: D) -> impl Fn(&[u8], Option) -> CoreOp +pub fn json_op(d: D) -> impl Fn(&[u8], Option) -> Op where D: Fn(Value, Option) -> Result, { @@ -50,7 +50,7 @@ where Ok(args) => args, Err(e) => { let buf = serialize_result(None, Err(OpError::from(e))); - return CoreOp::Sync(buf); + return Op::Sync(buf); } }; let promise_id = async_args.promise_id; @@ -60,32 +60,32 @@ where .map_err(OpError::from) .and_then(|args| d(args, zero_copy)); - // Convert to CoreOp + // Convert to Op match result { Ok(JsonOp::Sync(sync_value)) => { assert!(promise_id.is_none()); - CoreOp::Sync(serialize_result(promise_id, Ok(sync_value))) + Op::Sync(serialize_result(promise_id, Ok(sync_value))) } Ok(JsonOp::Async(fut)) => { assert!(promise_id.is_some()); let fut2 = fut.then(move |result| { - futures::future::ok(serialize_result(promise_id, result)) + futures::future::ready(serialize_result(promise_id, result)) }); - CoreOp::Async(fut2.boxed_local()) + Op::Async(fut2.boxed_local()) } Ok(JsonOp::AsyncUnref(fut)) => { assert!(promise_id.is_some()); let fut2 = fut.then(move |result| { - futures::future::ok(serialize_result(promise_id, result)) + futures::future::ready(serialize_result(promise_id, result)) }); - CoreOp::AsyncUnref(fut2.boxed_local()) + Op::AsyncUnref(fut2.boxed_local()) } Err(sync_err) => { let buf = serialize_result(promise_id, Err(sync_err)); if is_sync { - CoreOp::Sync(buf) + Op::Sync(buf) } else { - CoreOp::Async(futures::future::ok(buf).boxed_local()) + Op::Async(futures::future::ready(buf).boxed_local()) } } } -- cgit v1.2.3