pub fn new_direction(&mut self, dir: Direction) {
        if self.dir.opposite() == dir {
            return;
        }

        self.dir = dir;
    }
/// Update the snake's direction
Update the snake's direction
Update the snake ' s direction
pub fn new_direction(&mut self, dir: Direction) {
        if self.dir.opposite() == dir {
            return;
        }
        self.dir = dir;
    }
pub fn new_direction ( & mut self , dir : Direction ) { if self . dir . opposite ( ) == dir { return ; } self . dir = dir ; }
Update the snake's direction
Update the snake ' s direction
&mut self
dir
Direction
&mut self
dir
Direction