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§
type OpargType: Oparg
type Opcode: GenericOpcode
Sourcetype Instructions: InstructionAccess<Self::OpargType, Self>
type Instructions: InstructionAccess<Self::OpargType, Self>
This is the “list” version of the actual instruction (e.g. ExtInstructions)
Sourcetype OtherType: GenericInstruction
type OtherType: GenericInstruction
This is the related type. For example for Instruction this would be ExtInstruction and visa versa.
Required Methods§
fn get_opcode(&self) -> Self::Opcode
fn get_raw_value(&self) -> Self::OpargType
fn get_nop() -> Self
Provided Methods§
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
Sourcefn stack_effect(
&self,
oparg: u32,
jump: bool,
calculate_max: bool,
) -> StackEffect
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.