aboutsummaryrefslogtreecommitdiff
path: root/jsonrpc/examples/server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'jsonrpc/examples/server.rs')
-rw-r--r--jsonrpc/examples/server.rs10
1 files changed, 5 insertions, 5 deletions
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<Value, Error> {
+ async fn ping(&self, _params: Value) -> Result<Value, RPCError> {
Ok(serde_json::json!(Pong {}))
}
- async fn add(&self, params: Value) -> Result<Value, Error> {
+ async fn add(&self, params: Value) -> Result<Value, RPCError> {
let params: Req = serde_json::from_value(params)?;
Ok(serde_json::json!(params.x + params.y))
}
- async fn sub(&self, params: Value) -> Result<Value, Error> {
+ async fn sub(&self, params: Value) -> Result<Value, RPCError> {
let params: Req = serde_json::from_value(params)?;
Ok(serde_json::json!(params.x - params.y))
}
- async fn version(&self, _params: Value) -> Result<Value, Error> {
+ async fn version(&self, _params: Value) -> Result<Value, RPCError> {
Ok(serde_json::json!(self.version))
}
}