Skip to main content

string_to_opcode

Function string_to_opcode 

Source
pub fn string_to_opcode(name: &str) -> Option<u8>
Expand description

Convert an opcode name string to its byte value.

Supports all canonical names including aliases (e.g. OP_0, OP_ZERO, OP_FALSE all map to 0x00).

§Arguments

  • name - The opcode name (e.g. “OP_DUP”, “OP_CHECKSIG”).

§Returns

Some(byte) if the name is recognized, None otherwise.