Skip to content

Commit

Permalink
. rpc_router - minor comment and Debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremychone committed Jan 30, 2024
1 parent 2c7887f commit db8263e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions crates/libs/lib-rpc/src/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub use rpc_handler_wrapper::{RpcHandlerWrapper, RpcHandlerWrapperTrait};

use crate::RpcResources;
use crate::{Error, Result};
use core::fmt;
use futures::Future;
use serde::Deserialize;
use serde_json::Value;
Expand All @@ -55,6 +56,14 @@ pub struct RpcRequest {
pub params: Option<Value>,
}

impl fmt::Debug for RpcRouter {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RpcRouter")
.field("route_by_name", &self.route_by_name.keys())
.finish()
}
}

pub type PinFutureValue = Pin<Box<dyn Future<Output = Result<Value>> + Send>>;

/// method, which calls the appropriate handler matching the method_name.
Expand Down Expand Up @@ -145,10 +154,10 @@ impl RpcRouter {
/// Is equivalent to:
/// ```
/// RpcRouter::new()
/// .add_dyn("create_project", create_project.into_box())
/// .add_dyn("list_projects", list_projects.into_box())
/// .add_dyn("update_project", update_project.into_box())
/// .add_dyn("delete_project", delete_project.into_box())
/// .add_dyn("create_project", create_project.into_dyn())
/// .add_dyn("list_projects", list_projects.into_dyn())
/// .add_dyn("update_project", update_project.into_dyn())
/// .add_dyn("delete_project", delete_project.into_dyn())
/// ```
#[macro_export]
macro_rules! rpc_router {
Expand Down

0 comments on commit db8263e

Please sign in to comment.