Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 96d8f25d authored by WILLIAMS Harvey's avatar WILLIAMS Harvey
Browse files

Moved to iterator

parent ed9f2131
No related branches found
No related tags found
No related merge requests found
......@@ -82,11 +82,12 @@ impl Actor {
DispatchMessage::SendMessage { to, message} => {
// Look for senders to dispatch message to
if let Some(senders) = self.senders.get_mut(&to) {
for sender in senders.iter_mut() {
sender.try_send((to.clone(), message.clone())).expect("Expected sender channel to be closed and not full.")
}
senders
.iter_mut()
.try_for_each(|sender| sender.try_send((to.clone(), message.clone())))
.expect("Expected sender channel to be open and not full");
} else {
panic!("No sender with address {} to dispatch message to.", to);
eprintln!("No sender with address {} to dispatch - Message dropped.", to);
}
},
DispatchMessage::RegisterHandler { address, respond_to } => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment