How can I call get_chessboard in the code below?
error[E0499]: cannot borrow `*self` as mutable more than once at a time
--> src/main.rs:81:36
|
81 | self.player.set_chessboard(self.get_chessboard());
| ----------- -------------- ^^^^ second mutable borrow occurs here
| | |
| | first borrow later used by call
| first mutable borrow occurs here
impl Game {
fn new() -> Game { ... }
fn get_chessboard(&mut self) -> RenderBuffer { ... }
fn on_load(&mut self, w: &mut PistonWindow) {
self.player.set_chessboard(self.get_chessboard()); // HERE
^
}
}