Skip to content

Commit

Permalink
feat: make executable operable on mutable references
Browse files Browse the repository at this point in the history
commit-id:f73ba6d2
  • Loading branch information
Itay-Tsabary-Starkware committed May 20, 2024
1 parent 4febada commit 597efc4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/mempool_infra/src/component_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use tokio::sync::mpsc::{Receiver, Sender};

#[async_trait]
pub trait ComponentMessageExecutor<M, R> {
async fn execute(&self, message: M) -> R;
async fn execute(&mut self, message: M) -> R;
}

pub struct MessageAndResponseSender<M, R>
Expand Down
4 changes: 2 additions & 2 deletions crates/mempool_infra/src/component_server_client_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl ComponentATrait for ComponentClient<ComponentAMessages, ComponentAResponses

#[async_trait]
impl ComponentMessageExecutor<ComponentAMessages, ComponentAResponses> 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),
}
Expand Down Expand Up @@ -112,7 +112,7 @@ impl ComponentBTrait for ComponentClient<ComponentBMessages, ComponentBResponses

#[async_trait]
impl ComponentMessageExecutor<ComponentBMessages, ComponentBResponses> 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),
}
Expand Down

0 comments on commit 597efc4

Please sign in to comment.