From 844c28e22a5e6f2d74735f1759262e5185fcf9a0 Mon Sep 17 00:00:00 2001 From: Philip Peterson Date: Sat, 7 Dec 2019 20:20:21 -0800 Subject: [PATCH] Agent::handle -> Agent::handle_input --- README.md | 2 +- examples/multi_thread/src/context.rs | 2 +- examples/multi_thread/src/job.rs | 2 +- examples/multi_thread/src/native_worker.rs | 2 +- examples/routing/src/router.rs | 2 +- src/agent.rs | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3755c2268c6..b087ed18b02 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ impl Agent for Worker { fn update(&mut self, msg: Self::Message) { /* ... */ } // Handle incoming messages from components of other agents. - fn handle(&mut self, msg: Self::Input, who: HandlerId) { + fn handle_input(&mut self, msg: Self::Input, who: HandlerId) { match msg { Request::Question(_) => { self.link.respond(who, Response::Answer("That's cool!".into())); diff --git a/examples/multi_thread/src/context.rs b/examples/multi_thread/src/context.rs index 85375b663b5..c93a9461cb8 100644 --- a/examples/multi_thread/src/context.rs +++ b/examples/multi_thread/src/context.rs @@ -55,7 +55,7 @@ impl Agent for Worker { } } - fn handle(&mut self, msg: Self::Input, who: HandlerId) { + fn handle_input(&mut self, msg: Self::Input, who: HandlerId) { info!("Request: {:?}", msg); match msg { Request::GetDataFromServer => { diff --git a/examples/multi_thread/src/job.rs b/examples/multi_thread/src/job.rs index da2d98ca87a..a9d21aa4144 100644 --- a/examples/multi_thread/src/job.rs +++ b/examples/multi_thread/src/job.rs @@ -55,7 +55,7 @@ impl Agent for Worker { } } - fn handle(&mut self, msg: Self::Input, who: HandlerId) { + fn handle_input(&mut self, msg: Self::Input, who: HandlerId) { info!("Request: {:?}", msg); match msg { Request::GetDataFromServer => { diff --git a/examples/multi_thread/src/native_worker.rs b/examples/multi_thread/src/native_worker.rs index 2c782f22be5..723d54cec46 100644 --- a/examples/multi_thread/src/native_worker.rs +++ b/examples/multi_thread/src/native_worker.rs @@ -55,7 +55,7 @@ impl Agent for Worker { } } - fn handle(&mut self, msg: Self::Input, who: HandlerId) { + fn handle_input(&mut self, msg: Self::Input, who: HandlerId) { info!("Request: {:?}", msg); match msg { Request::GetDataFromServer => { diff --git a/examples/routing/src/router.rs b/examples/routing/src/router.rs index 682bbe830f1..60ef1fd1bf6 100644 --- a/examples/routing/src/router.rs +++ b/examples/routing/src/router.rs @@ -143,7 +143,7 @@ where } } - fn handle(&mut self, msg: Self::Input, who: HandlerId) { + fn handle_input(&mut self, msg: Self::Input, who: HandlerId) { info!("Request: {:?}", msg); match msg { Request::ChangeRoute(route) => { diff --git a/src/agent.rs b/src/agent.rs index e403bf8bd8c..fe2508de6cf 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -692,7 +692,7 @@ pub trait Agent: Sized + 'static { fn connected(&mut self, _id: HandlerId) {} /// This method called on every incoming message. - fn handle(&mut self, msg: Self::Input, id: HandlerId); + fn handle_input(&mut self, msg: Self::Input, id: HandlerId); /// This method called on when a new bridge destroyed. fn disconnected(&mut self, _id: HandlerId) {} @@ -877,7 +877,7 @@ where this.agent .as_mut() .expect("agent was not created to process inputs") - .handle(inp, id); + .handle_input(inp, id); } AgentLifecycleEvent::Disconnected(id) => { this.agent