aboutsummaryrefslogtreecommitdiff
path: root/src/endpoint.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/endpoint.rs')
-rw-r--r--src/endpoint.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/endpoint.rs b/src/endpoint.rs
index 760bf32..b408241 100644
--- a/src/endpoint.rs
+++ b/src/endpoint.rs
@@ -1,5 +1,6 @@
use std::marker::PhantomData;
use std::sync::Arc;
+use std::borrow::Borrow;
use arc_swap::ArcSwapOption;
use async_trait::async_trait;
@@ -88,16 +89,17 @@ where
/// Call this endpoint on a remote node (or on the local node,
/// for that matter)
- pub async fn call(
+ pub async fn call<B>(
&self,
target: &NodeID,
- req: &M,
+ req: B,
prio: RequestPriority,
- ) -> Result<<M as Message>::Response, Error> {
+ ) -> Result<<M as Message>::Response, Error>
+ where B: Borrow<M> {
if *target == self.netapp.id {
match self.handler.load_full() {
None => Err(Error::NoHandler),
- Some(h) => Ok(h.handle(req, self.netapp.id).await),
+ Some(h) => Ok(h.handle(req.borrow(), self.netapp.id).await),
}
} else {
let conn = self