pub struct BasicInstructionFetcher<I, CustomError = CustomErrorPlaceholder>where
I: Instruction,{ /* private fields */ }Expand description
Basic instruction fetcher implementation.
This implementation is intentionally basic and correct, but not the most performant. It is possible to have a more efficient implementation that skips certain checks by placing additional constraints on the constructor.
Note that it loads instructions from anywhere in memory. This works, but it is likely that you want to restrict this to a specific executable region of memory.
Implementations§
Source§impl<I, CustomError> BasicInstructionFetcher<I, CustomError>where
I: Instruction,
impl<I, CustomError> BasicInstructionFetcher<I, CustomError>where
I: Instruction,
Trait Implementations§
Source§impl<I, CustomError: Clone> Clone for BasicInstructionFetcher<I, CustomError>where
I: Instruction + Clone,
impl<I, CustomError: Clone> Clone for BasicInstructionFetcher<I, CustomError>where
I: Instruction + Clone,
Source§fn clone(&self) -> BasicInstructionFetcher<I, CustomError>
fn clone(&self) -> BasicInstructionFetcher<I, CustomError>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<I, CustomError: Debug> Debug for BasicInstructionFetcher<I, CustomError>where
I: Instruction + Debug,
impl<I, CustomError: Debug> Debug for BasicInstructionFetcher<I, CustomError>where
I: Instruction + Debug,
Source§impl<I, Memory, CustomError> InstructionFetcher<I, Memory, CustomError> for BasicInstructionFetcher<I, CustomError>where
I: Instruction,
Memory: VirtualMemory,
impl<I, Memory, CustomError> InstructionFetcher<I, Memory, CustomError> for BasicInstructionFetcher<I, CustomError>where
I: Instruction,
Memory: VirtualMemory,
Source§fn fetch_instruction(
&mut self,
memory: &Memory,
) -> Result<FetchInstructionResult<I>, ExecutionError<<<I as Instruction>::Reg as Register>::Type, CustomError>>
fn fetch_instruction( &mut self, memory: &Memory, ) -> Result<FetchInstructionResult<I>, ExecutionError<<<I as Instruction>::Reg as Register>::Type, CustomError>>
Fetch a single instruction at a specified address and advance the program counter on
successful fetch
Source§impl<I, Memory, CustomError> ProgramCounter<<<I as Instruction>::Reg as Register>::Type, Memory, CustomError> for BasicInstructionFetcher<I, CustomError>where
I: Instruction,
Memory: VirtualMemory,
impl<I, Memory, CustomError> ProgramCounter<<<I as Instruction>::Reg as Register>::Type, Memory, CustomError> for BasicInstructionFetcher<I, CustomError>where
I: Instruction,
Memory: VirtualMemory,
Source§fn get_pc(&self) -> <<I as Instruction>::Reg as Register>::Type
fn get_pc(&self) -> <<I as Instruction>::Reg as Register>::Type
Get the current value of the program counter
Source§fn set_pc(
&mut self,
_memory: &Memory,
pc: <<I as Instruction>::Reg as Register>::Type,
) -> Result<ControlFlow<()>, ProgramCounterError<<<I as Instruction>::Reg as Register>::Type, CustomError>>
fn set_pc( &mut self, _memory: &Memory, pc: <<I as Instruction>::Reg as Register>::Type, ) -> Result<ControlFlow<()>, ProgramCounterError<<<I as Instruction>::Reg as Register>::Type, CustomError>>
Set the current value of the program counter
impl<I, CustomError: Copy> Copy for BasicInstructionFetcher<I, CustomError>where
I: Instruction + Copy,
Auto Trait Implementations§
impl<I, CustomError> Freeze for BasicInstructionFetcher<I, CustomError>where
<<I as Instruction>::Reg as Register>::Type: Freeze,
impl<I, CustomError> RefUnwindSafe for BasicInstructionFetcher<I, CustomError>where
<<I as Instruction>::Reg as Register>::Type: RefUnwindSafe,
CustomError: RefUnwindSafe,
impl<I, CustomError> Send for BasicInstructionFetcher<I, CustomError>where
CustomError: Send,
impl<I, CustomError> Sync for BasicInstructionFetcher<I, CustomError>where
CustomError: Sync,
impl<I, CustomError> Unpin for BasicInstructionFetcher<I, CustomError>
impl<I, CustomError> UnsafeUnpin for BasicInstructionFetcher<I, CustomError>where
<<I as Instruction>::Reg as Register>::Type: UnsafeUnpin,
impl<I, CustomError> UnwindSafe for BasicInstructionFetcher<I, CustomError>where
<<I as Instruction>::Reg as Register>::Type: UnwindSafe,
CustomError: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more