Skip to content

Commit

Permalink
Make RouterHandler an FnMut rather than an Fn.
Browse files Browse the repository at this point in the history
This codifies the constraint that handlers can't be called recursively.
  • Loading branch information
eefriedman committed Oct 12, 2015
1 parent 5e71fe6 commit 9b71253
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -128,5 +128,5 @@ enum RouterMsg {
AddRoute(OpaqueIpcReceiver, RouterHandler),
}

pub type RouterHandler = Box<Fn(OpaqueIpcMessage) + Send>;
pub type RouterHandler = Box<FnMut(OpaqueIpcMessage) + Send>;

0 comments on commit 9b71253

Please sign in to comment.