Skip to content

Instantly share code, notes, and snippets.

@umurgdk
Created July 19, 2017 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umurgdk/f65b9de75b694b12537cc72eb49dfb75 to your computer and use it in GitHub Desktop.
Save umurgdk/f65b9de75b694b12537cc72eb49dfb75 to your computer and use it in GitHub Desktop.
for event in self.events.poll_iter() {
match event {
Event::Quit { .. } => self.running = false,
event => self.input.update(&self.events, event)
}
}
@umurgdk
Copy link
Author

umurgdk commented Jul 19, 2017

error[E0502]: cannot borrow `self.events` as immutable because it is also borrowed as mutable
   --> src/game_context.rs:103:58
    |
100 |         for event in self.events.poll_iter() {
    |                      ----------- mutable borrow occurs here
...
103 |                 event              => self.input.update(&self.events, event)
    |                                                          ^^^^^^^^^^^ immutable borrow occurs here
104 |             }
105 |         }
    |         - mutable borrow ends here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment