diff options
author | hozan23 <hozan23@karyontech.net> | 2024-06-15 00:02:19 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-06-15 00:02:19 +0200 |
commit | 5064133f1f59be9539ff6a2ebd830132b2379564 (patch) | |
tree | 3722421bea0b3dd21137f9abc98e3e6c950d76d8 /jsonrpc/src/server/pubsub_service.rs | |
parent | 3429caa87699d986f799a11f6e0f4526e723b655 (diff) |
jsonrpc: separate the RPC errors from the library implementation errors
Diffstat (limited to 'jsonrpc/src/server/pubsub_service.rs')
-rw-r--r-- | jsonrpc/src/server/pubsub_service.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/jsonrpc/src/server/pubsub_service.rs b/jsonrpc/src/server/pubsub_service.rs index 08d1bbb..a6b4c11 100644 --- a/jsonrpc/src/server/pubsub_service.rs +++ b/jsonrpc/src/server/pubsub_service.rs @@ -1,6 +1,6 @@ use std::{future::Future, pin::Pin, sync::Arc}; -use crate::Result; +use crate::RPCResult; use super::channel::Channel; @@ -8,7 +8,7 @@ use super::channel::Channel; pub type PubSubRPCMethod<'a> = Box<dyn Fn(Arc<Channel>, String, serde_json::Value) -> PubSubRPCMethodOutput<'a> + Send + 'a>; type PubSubRPCMethodOutput<'a> = - Pin<Box<dyn Future<Output = Result<serde_json::Value>> + Send + Sync + 'a>>; + Pin<Box<dyn Future<Output = RPCResult<serde_json::Value>> + Send + Sync + 'a>>; /// Defines the interface for an RPC service. pub trait PubSubRPCService: Sync + Send { @@ -23,16 +23,16 @@ pub trait PubSubRPCService: Sync + Send { /// ``` /// use serde_json::Value; /// -/// use karyon_jsonrpc::{Error, impl_rpc_service}; +/// use karyon_jsonrpc::{RPCError, impl_rpc_service}; /// /// struct Hello {} /// /// impl Hello { -/// async fn foo(&self, params: Value) -> Result<Value, Error> { +/// async fn foo(&self, params: Value) -> Result<Value, RPCError> { /// Ok(serde_json::json!("foo!")) /// } /// -/// async fn bar(&self, params: Value) -> Result<Value, Error> { +/// async fn bar(&self, params: Value) -> Result<Value, RPCError> { /// Ok(serde_json::json!("bar!")) /// } /// } |