fn with_player<F>(&mut self, id: usize, f: F)
    where
        F: FnOnce(&mut Player) -> io::Result<()>,
    {
        match f(&mut self.players[id]) {
            Ok(()) => return,
            Err(e) => {
                error!("lost connection to player #{} - {}", id, e);
            }
        }

        self.players.remove(id);
    }
/// Calls a closure with a mutable reference to the given player.
///
/// If the closure returns `Err`, the player will be disconnected.
Calls a closure with a mutable reference to the given player.
If the closure returns `Err`, the player will be disconnected.
Calls a closure with a mutable reference to the given player . If the closure returns ` Err ` the player will be disconnected .
fn with_player<F>(&mut self, id: usize, f: F)
    where
        F: FnOnce(&mut Player) -> io::Result<()>,
    {
        match f(&mut self.players[id]) {
            Ok(()) => return,
            Err(e) => {
                error!("lost connection to player #{} - {}", id, e);
            }
        }
        self.players.remove(id);
    }
fn with_player < F > ( & mut self , id : usize , f : F ) where F : FnOnce ( & mut Player ) -> io :: Result < ( ) > , { match f ( & mut self . players [ id ] ) { Ok ( ( ) ) => return , Err ( e ) => { error ! ( " " id e ) ; } } self . players . remove ( id ) ; }
Calls a closure with a mutable reference to the given player.
Calls a closure with a mutable reference to the given player .
&mut self
id
usize
f
F