CommandTrait

Trait CommandTrait 

Source
pub trait CommandTrait {
    // Required methods
    fn execute(&self, state: &mut GameState) -> Result<()>;
    fn get_type(&self) -> CommandType;
}
Expand description

A trait that defines the basic behavior for all commands in the game.

Required Methods§

Source

fn execute(&self, state: &mut GameState) -> Result<()>

Executes the command on the given game state.

§Arguments
  • state - A mutable reference to the current game state.
§Returns

A Result indicating success or containing an error if the command execution failed.

Source

fn get_type(&self) -> CommandType

Gets the type of the command.

Implementors§