pub fn perform_aimed(mut self, cmd: MoveCommand) -> Self {
        use Direction::*;

        // Destructure move into direction and distance
        let MoveCommand(dir, amt) = cmd;
        let amt = amt as i64;

        match dir {
            Up => self.aim -= amt,
            Down => self.aim += amt,
            Forward => {
                self.pos_x += amt;
                self.pos_z += amt * self.aim;
            },
        }

        self
    }
/// Perform a movement on the submarine.
Perform a movement on the submarine.
Perform a movement on the submarine .
pub fn perform_aimed(mut self, cmd: MoveCommand) -> Self {
        use Direction::*;
        // Destructure move into direction and distance
        let MoveCommand(dir, amt) = cmd;
        let amt = amt as i64;
        match dir {
            Up => self.aim -= amt,
            Down => self.aim += amt,
            Forward => {
                self.pos_x += amt;
                self.pos_z += amt * self.aim;
            },
        }
        self
    }
pub fn perform_aimed ( mut self , cmd : MoveCommand ) -> Self { use Direction :: * ; // Destructure move into direction and distance let MoveCommand ( dir , amt ) = cmd ; let amt = amt as i64 ; match dir { Up => self . aim -= amt , Down => self . aim += amt , Forward => { self . pos_x += amt ; self . pos_z += amt * self . aim ; } , } self }
Perform a movement on the submarine.
Perform a movement on the submarine .
mut self
cmd
MoveCommand