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§
fn normalize(&self) -> NormalizedCommand
fn denormalize(generalized: &NormalizedCommand) -> Option<Box<Self>>where
Self: Sized,
Sourcefn execute(&self, worker: &mut Worker) -> Error
fn execute(&self, worker: &mut Worker) -> Error
§Errors
This errors when the command cannot be executed by the worker