pub fn can_move(&mut self, direction: Directions) -> Result<u16, ()> {
        let exits: Vec<&Exits> = self
            .exits
            .iter()
            .filter(|exit| exit.direction == direction)
            .collect();
        if !exits.is_empty() {
            Ok(exits[0].room_id)
        } else {
            Err(())
        }
    }
/// This function checks if the player can move
/// in the direction specified by the action struct.
///
/// If an exit with the given direction exits, move
/// the player there.
This function checks if the player can move
in the direction specified by the action struct.

If an exit with the given direction exits, move
the player there.
This function checks if the player can move in the direction specified by the action struct . If an exit with the given direction exits move the player there .
pub fn can_move(&mut self, direction: Directions) -> Result<u16, ()> {
        let exits: Vec<&Exits> = self
            .exits
            .iter()
            .filter(|exit| exit.direction == direction)
            .collect();
        if !exits.is_empty() {
            Ok(exits[0].room_id)
        } else {
            Err(())
        }
    }
pub fn can_move ( & mut self , direction : Directions ) -> Result < u16 , ( ) > { let exits : Vec < & Exits > = self . exits . iter ( ) . filter ( | exit | exit . direction == direction ) . collect ( ) ; if ! exits . is_empty ( ) { Ok ( exits [ 0 ] . room_id ) } else { Err ( ( ) ) } }
This function checks if the player can move
in the direction specified by the action struct.
This function checks if the player can move in the direction specified by the action struct .
&mut self
direction
Directions
&mut self
direction
Directions