pub struct PC<'a, P: Patch> { /* private fields */ }
Expand description
Represents a program counter in EVM.
Implementations
sourceimpl<'a, P: Patch> PC<'a, P>
impl<'a, P: Patch> PC<'a, P>
sourcepub fn code(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn code(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Get the code bytearray.
sourcepub fn opcode_position(&self) -> usize
pub fn opcode_position(&self) -> usize
Get the current opcode position. Should only be used when debugging.
sourcepub fn is_valid(&self, position: usize) -> bool
pub fn is_valid(&self, position: usize) -> bool
Returns true
if the position is a valid jump destination. If
not, returns false
.
sourcepub fn is_end(&self) -> bool
pub fn is_end(&self) -> bool
Check whether the PC is ended. Next read
on this PC would
result in PCError::PCOverflow
.
sourcepub fn peek_opcode(&self) -> Result<Opcode, OnChainError>
pub fn peek_opcode(&self) -> Result<Opcode, OnChainError>
Peek the next opcode.
sourcepub fn peek(&self) -> Result<Instruction, OnChainError>
pub fn peek(&self) -> Result<Instruction, OnChainError>
Peek the next instruction.
Auto Trait Implementations
impl<'a, P> RefUnwindSafe for PC<'a, P>where
P: RefUnwindSafe,
impl<'a, P> Send for PC<'a, P>where
P: Send,
impl<'a, P> Sync for PC<'a, P>where
P: Sync,
impl<'a, P> Unpin for PC<'a, P>where
P: Unpin,
impl<'a, P> UnwindSafe for PC<'a, P>where
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more