aboutsummaryrefslogtreecommitdiff
path: root/src/endpoint.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/endpoint.rs')
-rw-r--r--src/endpoint.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/endpoint.rs b/src/endpoint.rs
index adb3532..77d7468 100644
--- a/src/endpoint.rs
+++ b/src/endpoint.rs
@@ -26,7 +26,7 @@ pub trait EndpointHandler<M>: Send + Sync
where
M: Message,
{
- async fn handle(self: &Arc<Self>, m: M, from: NodeID) -> M::Response;
+ async fn handle(self: &Arc<Self>, m: &M, from: NodeID) -> M::Response;
}
/// If one simply wants to use an endpoint in a client fashion,
@@ -35,7 +35,7 @@ where
/// it will panic if it is ever made to handle request.
#[async_trait]
impl<M: Message + 'static> EndpointHandler<M> for () {
- async fn handle(self: &Arc<()>, _m: M, _from: NodeID) -> M::Response {
+ async fn handle(self: &Arc<()>, _m: &M, _from: NodeID) -> M::Response {
panic!("This endpoint should not have a local handler.");
}
}
@@ -86,7 +86,7 @@ where
pub async fn call(
&self,
target: &NodeID,
- req: M,
+ req: &M,
prio: RequestPriority,
) -> Result<<M as Message>::Response, Error> {
if *target == self.netapp.id {
@@ -141,7 +141,7 @@ where
None => Err(Error::NoHandler),
Some(h) => {
let req = rmp_serde::decode::from_read_ref::<_, M>(buf)?;
- let res = h.handle(req, from).await;
+ let res = h.handle(&req, from).await;
let res_bytes = rmp_to_vec_all_named(&res)?;
Ok(res_bytes)
}