From 5064133f1f59be9539ff6a2ebd830132b2379564 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sat, 15 Jun 2024 00:02:19 +0200 Subject: jsonrpc: separate the RPC errors from the library implementation errors --- jsonrpc/examples/server.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'jsonrpc/examples/server.rs') diff --git a/jsonrpc/examples/server.rs b/jsonrpc/examples/server.rs index 31e65dd..acbe2a9 100644 --- a/jsonrpc/examples/server.rs +++ b/jsonrpc/examples/server.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use serde_json::Value; use karyon_core::async_util::sleep; -use karyon_jsonrpc::{rpc_impl, Error, Server}; +use karyon_jsonrpc::{rpc_impl, RPCError, Server}; struct Calc { version: String, @@ -21,21 +21,21 @@ struct Pong {} #[rpc_impl] impl Calc { - async fn ping(&self, _params: Value) -> Result { + async fn ping(&self, _params: Value) -> Result { Ok(serde_json::json!(Pong {})) } - async fn add(&self, params: Value) -> Result { + async fn add(&self, params: Value) -> Result { let params: Req = serde_json::from_value(params)?; Ok(serde_json::json!(params.x + params.y)) } - async fn sub(&self, params: Value) -> Result { + async fn sub(&self, params: Value) -> Result { let params: Req = serde_json::from_value(params)?; Ok(serde_json::json!(params.x - params.y)) } - async fn version(&self, _params: Value) -> Result { + async fn version(&self, _params: Value) -> Result { Ok(serde_json::json!(self.version)) } } -- cgit v1.2.3