Skip to main content

instruction_execution

Attribute Macro instruction_execution 

Source
#[instruction_execution]
Expand description

Processes #[instruction_execution] attribute on both enum execution implementations.

It must be applied to enum, whose definition is already annotated with #[instruction] macro.

Similarly to that macro, this macro will process the contents of the ExecutableInstruction trait implementation. execute() implementation will end up containing both inherited and own execution logic according to the ordering set in #[instruction].

There are constraints on the execute() method body, it must have one or both (but nothing else) of the following:

  • matching in the following style: match self { Self::Variant { .. } }
    • note that Self must be used instead of the explicit type name, such that it works when inherited
  • Ok(ControlFlow::Continue(())) expression