diff options
Diffstat (limited to 'cli/ops/dispatch_json.rs')
-rw-r--r-- | cli/ops/dispatch_json.rs | 20 |
1 files changed, 10 insertions, 10 deletions
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<u64>, } -pub fn json_op<D>(d: D) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> CoreOp +pub fn json_op<D>(d: D) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> Op where D: Fn(Value, Option<ZeroCopyBuf>) -> Result<JsonOp, OpError>, { @@ -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()) } } } |