Instruction

Trait Instruction 

Source
pub trait Instruction:
    Display
    + Debug
    + Clone
    + Copy
    + PartialEq
    + EqTrait
    + Hash {
    // Required method
    fn opcode(&self) -> OpCode;

    // Provided methods
    fn is_push(&self) -> bool { ... }
    fn is_dup(&self) -> bool { ... }
    fn is_swap(&self) -> bool { ... }
    fn is_log(&self) -> bool { ... }
    fn is_terminator(&self) -> bool { ... }
}
Expand description

General instruction information.

Required Methods§

Source

fn opcode(&self) -> OpCode

Return the operation code associated with this instruction.

Provided Methods§

Source

fn is_push(&self) -> bool

Returns a value signifying whether this instruction is of the type PUSHx.

§Example
assert_eq!(Push::new([0; 10]).is_push(), true);
assert_eq!(Gas.is_push(), false);
Source

fn is_dup(&self) -> bool

Returns a value signifying whether this instruction is of the type DUPx.

§Example
assert_eq!(Dup::<10>::new().is_dup(), true);
assert_eq!(Gas.is_dup(), false);
Source

fn is_swap(&self) -> bool

Returns a value signifying whether this instruction is of the type SWAPx.

§Example
assert_eq!(Swap::<10>::new().is_swap(), true);
assert_eq!(Gas.is_swap(), false);
Source

fn is_log(&self) -> bool

Returns a value signifying whether this instruction is of the type LOGx.

§Example
assert_eq!(Log::<3>::new().is_log(), true);
assert_eq!(Gas.is_log(), false);
Source

fn is_terminator(&self) -> bool

Returns true for instructions that terminate execution of the smart contract.

§Example
assert_eq!(Return.is_terminator(), true);
assert_eq!(Unknown(0xF).is_terminator(), true);
assert_eq!(Gas.is_terminator(), false);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Instruction for Add

Source§

impl Instruction for AddMod

Source§

impl Instruction for Address

Source§

impl Instruction for And

Source§

impl Instruction for Balance

Source§

impl Instruction for BaseFee

Source§

impl Instruction for BlobBaseFee

Source§

impl Instruction for BlobHash

Source§

impl Instruction for BlockHash

Source§

impl Instruction for Byte

Source§

impl Instruction for Call

Source§

impl Instruction for CallCode

Source§

impl Instruction for CallDataCopy

Source§

impl Instruction for CallDataLoad

Source§

impl Instruction for CallDataSize

Source§

impl Instruction for CallValue

Source§

impl Instruction for Caller

Source§

impl Instruction for ChainId

Source§

impl Instruction for CodeCopy

Source§

impl Instruction for CodeSize

Source§

impl Instruction for CoinBase

Source§

impl Instruction for Create2

Source§

impl Instruction for Create

Source§

impl Instruction for DelegateCall

Source§

impl Instruction for Div

Source§

impl Instruction for Eq

Source§

impl Instruction for Exp

Source§

impl Instruction for ExtCodeCopy

Source§

impl Instruction for ExtCodeHash

Source§

impl Instruction for ExtCodeSize

Source§

impl Instruction for Gas

Source§

impl Instruction for GasLimit

Source§

impl Instruction for GasPrice

Source§

impl Instruction for Gt

Source§

impl Instruction for Invalid

Source§

impl Instruction for IsZero

Source§

impl Instruction for Jump

Source§

impl Instruction for JumpDest

Source§

impl Instruction for JumpI

Source§

impl Instruction for Keccak256

Source§

impl Instruction for Lt

Source§

impl Instruction for MCopy

Source§

impl Instruction for MLoad

Source§

impl Instruction for MSize

Source§

impl Instruction for MStore8

Source§

impl Instruction for MStore

Source§

impl Instruction for Mod

Source§

impl Instruction for Mul

Source§

impl Instruction for MulMod

Source§

impl Instruction for Not

Source§

impl Instruction for Number

Source§

impl Instruction for Or

Source§

impl Instruction for Origin

Source§

impl Instruction for Pc

Source§

impl Instruction for Pop

Source§

impl Instruction for PrevRandao

Source§

impl Instruction for Return

Source§

impl Instruction for ReturnDataCopy

Source§

impl Instruction for ReturnDataSize

Source§

impl Instruction for Revert

Source§

impl Instruction for SDiv

Source§

impl Instruction for SGt

Source§

impl Instruction for SLoad

Source§

impl Instruction for SLt

Source§

impl Instruction for SMod

Source§

impl Instruction for SStore

Source§

impl Instruction for Sar

Source§

impl Instruction for SelfBalance

Source§

impl Instruction for SelfDestruct

Source§

impl Instruction for Shl

Source§

impl Instruction for Shr

Source§

impl Instruction for SignExtend

Source§

impl Instruction for StaticCall

Source§

impl Instruction for Stop

Source§

impl Instruction for Sub

Source§

impl Instruction for TLoad

Source§

impl Instruction for TStore

Source§

impl Instruction for Timestamp

Source§

impl Instruction for Unknown

Source§

impl Instruction for Xor

Source§

impl<const N: u8> Instruction for Dup<N>

Source§

impl<const N: u8> Instruction for Log<N>

Source§

impl<const N: u8> Instruction for Swap<N>

Source§

impl<const N: usize> Instruction for Push<N>