Skip to main content

GenericInstruction

Trait GenericInstruction 

Source
pub trait GenericInstruction:
    PartialEq
    + Debug
    + Clone {
    type OpargType: Oparg;
    type Opcode: GenericOpcode;
    type Instructions: InstructionAccess<Self::OpargType, Self>;
    type OtherType: GenericInstruction;

Show 13 methods // Required methods fn get_opcode(&self) -> Self::Opcode; fn get_raw_value(&self) -> Self::OpargType; fn get_nop() -> Self; // Provided methods fn is_jump(&self) -> bool { ... } fn is_absolute_jump(&self) -> bool { ... } fn is_relative_jump(&self) -> bool { ... } fn is_jump_forwards(&self) -> bool { ... } fn is_jump_backwards(&self) -> bool { ... } fn is_conditional_jump(&self) -> bool { ... } fn stops_execution(&self) -> bool { ... } fn is_extended_arg(&self) -> bool { ... } fn is_cache(&self) -> bool { ... } fn stack_effect( &self, oparg: u32, jump: bool, calculate_max: bool, ) -> StackEffect { ... }
}
Expand description

Generic instruction functions used by all versions

Required Associated Types§

Source

type OpargType: Oparg

Source

type Opcode: GenericOpcode

Source

type Instructions: InstructionAccess<Self::OpargType, Self>

This is the “list” version of the actual instruction (e.g. ExtInstructions)

Source

type OtherType: GenericInstruction

This is the related type. For example for Instruction this would be ExtInstruction and visa versa.

Required Methods§

Source

fn get_opcode(&self) -> Self::Opcode

Source

fn get_raw_value(&self) -> Self::OpargType

Source

fn get_nop() -> Self

Provided Methods§

Source

fn is_jump(&self) -> bool

Relative or absolute jump

Source

fn is_absolute_jump(&self) -> bool

Source

fn is_relative_jump(&self) -> bool

Source

fn is_jump_forwards(&self) -> bool

Source

fn is_jump_backwards(&self) -> bool

Source

fn is_conditional_jump(&self) -> bool

Source

fn stops_execution(&self) -> bool

Source

fn is_extended_arg(&self) -> bool

Source

fn is_cache(&self) -> bool

Source

fn stack_effect( &self, oparg: u32, jump: bool, calculate_max: bool, ) -> StackEffect

If the code has a jump target and jump is true, stack_effect() will return the stack effect of jumping. If jump is false, it will return the stack effect of not jumping. And if calculate_max is true, it will return the maximal stack effect of both cases.

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§