From 597efc4787ed403c9e7f8b37b9c07621d472f9c9 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Mon, 20 May 2024 14:30:50 +0300 Subject: [PATCH] feat: make executable operable on mutable references commit-id:f73ba6d2 --- crates/mempool_infra/src/component_server.rs | 2 +- crates/mempool_infra/src/component_server_client_test.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/mempool_infra/src/component_server.rs b/crates/mempool_infra/src/component_server.rs index 25d9ec08..85a8a876 100644 --- a/crates/mempool_infra/src/component_server.rs +++ b/crates/mempool_infra/src/component_server.rs @@ -3,7 +3,7 @@ use tokio::sync::mpsc::{Receiver, Sender}; #[async_trait] pub trait ComponentMessageExecutor { - async fn execute(&self, message: M) -> R; + async fn execute(&mut self, message: M) -> R; } pub struct MessageAndResponseSender diff --git a/crates/mempool_infra/src/component_server_client_test.rs b/crates/mempool_infra/src/component_server_client_test.rs index aac362d1..0946418a 100644 --- a/crates/mempool_infra/src/component_server_client_test.rs +++ b/crates/mempool_infra/src/component_server_client_test.rs @@ -65,7 +65,7 @@ impl ComponentATrait for ComponentClient for ComponentA { - async fn execute(&self, message: ComponentAMessages) -> ComponentAResponses { + async fn execute(&mut self, message: ComponentAMessages) -> ComponentAResponses { match message { ComponentAMessages::AGetValue => ComponentAResponses::Value(self.a_get_value().await), } @@ -112,7 +112,7 @@ impl ComponentBTrait for ComponentClient for ComponentB { - async fn execute(&self, message: ComponentBMessages) -> ComponentBResponses { + async fn execute(&mut self, message: ComponentBMessages) -> ComponentBResponses { match message { ComponentBMessages::BGetValue => ComponentBResponses::Value(self.b_get_value().await), }