Skip to content

Commit

Permalink
Auto merge of servo#12 - eefriedman:router-handler, r=pcwalton
Browse files Browse the repository at this point in the history
Make RouterHandler an FnMut rather than an Fn.

This codifies the constraint that handlers can't be called recursively.
  • Loading branch information
bors-servo committed Jan 13, 2016
2 parents cb08050 + 9b71253 commit dfd8513
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 dfd8513

Please sign in to comment.