pub trait ProgramCounter {
type Instruction;
// Required methods
fn pc(&self) -> u32;
fn pc_mut(&mut self) -> &mut u32;
fn get_instruction(&self, pc: u32) -> Result<&Self::Instruction>;
// Provided methods
fn peek_instruction(&self) -> Result<&Self::Instruction> { ... }
fn next_instruction(&mut self) -> Result<&Self::Instruction> { ... }
}Required Associated Types§
type Instruction
Required Methods§
Sourcefn get_instruction(&self, pc: u32) -> Result<&Self::Instruction>
fn get_instruction(&self, pc: u32) -> Result<&Self::Instruction>
Get the instruction at the given program counter without advancing it.
Provided Methods§
Sourcefn peek_instruction(&self) -> Result<&Self::Instruction>
fn peek_instruction(&self) -> Result<&Self::Instruction>
Peek the current instruction without advancing the program counter.
Sourcefn next_instruction(&mut self) -> Result<&Self::Instruction>
fn next_instruction(&mut self) -> Result<&Self::Instruction>
Get the current instruction and advance the program counter by 1.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".