Skip to main content

Command

Trait Command 

Source
pub trait Command: Debug {
    // Required methods
    fn normalize(&self) -> NormalizedCommand;
    fn denormalize(generalized: &NormalizedCommand) -> Option<Box<Self>>
       where Self: Sized;
    fn execute(&self, worker: &mut Worker) -> Error;
    fn get_name(&self) -> &'static str;
}
Expand description

When adding a command:

  • a command has to submit itself to the inventory
  • write a test that it’s conversion between normalizel and denormalize works

Required Methods§

Source

fn normalize(&self) -> NormalizedCommand

Source

fn denormalize(generalized: &NormalizedCommand) -> Option<Box<Self>>
where Self: Sized,

Source

fn execute(&self, worker: &mut Worker) -> Error

§Errors

This errors when the command cannot be executed by the worker

Source

fn get_name(&self) -> &'static str

Implementors§