From 3b8bff634198c5ae17ab16d5c85c30b3201ae593 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 21 Feb 2022 12:01:04 +0100 Subject: Refactoring --- src/endpoint.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/endpoint.rs') 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( &self, target: &NodeID, - req: &M, + req: B, prio: RequestPriority, - ) -> Result<::Response, Error> { + ) -> Result<::Response, Error> + where B: Borrow { 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 -- cgit v1.2.3