From 9b71253da283921b7d70d93fa002b822f7a0b518 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 12 Oct 2015 00:25:49 -0700 Subject: [PATCH] Make RouterHandler an FnMut rather than an Fn. This codifies the constraint that handlers can't be called recursively. --- router.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/router.rs b/router.rs index 2dd3b7eec..63a23e7f8 100644 --- a/router.rs +++ b/router.rs @@ -113,7 +113,7 @@ impl Router { } } IpcSelectionResult::MessageReceived(id, message) => { - self.handlers.get(&id).unwrap()(message) + self.handlers.get_mut(&id).unwrap()(message) } IpcSelectionResult::ChannelClosed(id) => { self.handlers.remove(&id).unwrap(); @@ -128,5 +128,5 @@ enum RouterMsg { AddRoute(OpaqueIpcReceiver, RouterHandler), } -pub type RouterHandler = Box; +pub type RouterHandler = Box;