define_opcodes

Macro define_opcodes 

Source
macro_rules! define_opcodes {
    (
        // Special case for Noop which shouldn't be in from_repr/from_name
        $(#[doc = $noop_doc:literal])*
        Noop = $noop_value:literal, $noop_name:literal,
            ($($noop_ret:expr),*), ($($noop_arg:expr),*);

        // All other opcodes
        $(
            $(#[doc = $doc:literal])*
            $variant:ident = $value:literal, $name:literal,
            ($($ret:expr),*), ($($arg:expr),*)
        );* $(;)?
    ) => { ... };
}
Expand description

Macro to define all opcodes in a single place. This generates the enum definition, from_name, from_repr, name, and arg_types methods.

Format for each opcode:

[doc_comments]
VariantName = 0xNN, "string_name", (return_types), (arg_types)

Note: Noop is handled specially - it’s excluded from from_repr and from_name as it should never appear in compiled binaries or source code.