diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-21 12:01:04 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-02-21 12:01:04 +0100 |
commit | 3b8bff634198c5ae17ab16d5c85c30b3201ae593 (patch) | |
tree | 8f3545c230c08c3a3100faf1293345e88a43d3dd /src/endpoint.rs | |
parent | 109d6c143d01b2d59027d45738692fa8ef6253ee (diff) | |
download | netapp-3b8bff634198c5ae17ab16d5c85c30b3201ae593.tar.gz netapp-3b8bff634198c5ae17ab16d5c85c30b3201ae593.zip |
Refactoring
Diffstat (limited to 'src/endpoint.rs')
-rw-r--r-- | src/endpoint.rs | 10 |
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 |