From e52bffc4cffed87705d6ebed2620de376b507958 Mon Sep 17 00:00:00 2001 From: rymnc <43716372+rymnc@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:50:54 +0530 Subject: [PATCH] chore: use generics for response_sender and task_request in handle_request function --- crates/services/p2p/src/service.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/services/p2p/src/service.rs b/crates/services/p2p/src/service.rs index 8a400abd81f..e21c83ee70a 100644 --- a/crates/services/p2p/src/service.rs +++ b/crates/services/p2p/src/service.rs @@ -442,18 +442,20 @@ where } } - fn handle_request( + fn handle_request( &mut self, range: Range, request_id: InboundRequestId, - response_sender: fn(Option) -> ResponseMessage, - db_lookup: F, - task_request: fn(Option, InboundRequestId) -> TaskRequest, + response_sender: ResponseSenderFn, + db_lookup: DbLookUpFn, + task_request: TaskRequestFn, ) -> anyhow::Result<()> where - F: FnOnce(&V::LatestView, Range) -> anyhow::Result> + DbLookUpFn: Fn(&V::LatestView, Range) -> anyhow::Result> + Send + 'static, + ResponseSenderFn: Fn(Option) -> ResponseMessage + Send + 'static, + TaskRequestFn: Fn(Option, InboundRequestId) -> TaskRequest + Send + 'static, R: Send + 'static, { let instant = Instant::now();