Trait Command

Source
pub trait Command: CommandInfo + 'static {
    type Output;

    // Required method
    fn on_execute(&self, ins: Instruction<'_>) -> Self::Output;
}
Expand description

Example:

use command_engine::{Command, CommandInfo, Instruction};

struct MyCommand1;

impl CommandInfo for MyCommand1 {
    fn caller(&self) -> &'static str {
        "command1"
    }
}

impl Command for MyCommand1 {
    type Output = ();

    fn on_execute(&self, _ins: Instruction) -> Self::Output {
        ()
    }
}

Required Associated Types§

Required Methods§

Source

fn on_execute(&self, ins: Instruction<'_>) -> Self::Output

Implementors§