pub struct StackModel { /* private fields */ }Expand description
Represents the current state of the EVM stack.
Stack positions are 0-indexed from the top:
- Position 0 = top of stack
- Position 1 = second from top
- etc.
Implementations§
Source§impl StackModel
impl StackModel
Sourcepub fn new() -> StackModel
pub fn new() -> StackModel
Creates a new empty stack model.
Sourcepub fn push_unknown(&mut self)
pub fn push_unknown(&mut self)
Pushes an unknown/anonymous value onto the stack.
Sourcepub fn pop(&mut self) -> Option<ValueId>
pub fn pop(&mut self) -> Option<ValueId>
Pops the top value from the stack. Returns the value that was at the top, if known.
Sourcepub fn peek(&self, depth: usize) -> Option<ValueId>
pub fn peek(&self, depth: usize) -> Option<ValueId>
Returns the value at the given stack depth (0 = top).
Sourcepub fn find(&self, value: ValueId) -> Option<usize>
pub fn find(&self, value: ValueId) -> Option<usize>
Finds the depth of a value on the stack. Returns None if the value is not on the stack.
Sourcepub fn count(&self, value: ValueId) -> usize
pub fn count(&self, value: ValueId) -> usize
Counts how many times a value appears on the stack.
Sourcepub fn is_on_top(&self, value: ValueId) -> bool
pub fn is_on_top(&self, value: ValueId) -> bool
Returns true if the value is at the top of the stack.
Sourcepub fn is_accessible(&self, value: ValueId) -> bool
pub fn is_accessible(&self, value: ValueId) -> bool
Returns true if the value is accessible via DUP (depth < 16).
Sourcepub fn dup(&mut self, n: u8)
pub fn dup(&mut self, n: u8)
Simulates a DUP operation.
n is 1-indexed (DUP1 = duplicate top, DUP2 = duplicate second from top).
Sourcepub fn swap(&mut self, n: u8)
pub fn swap(&mut self, n: u8)
Simulates a SWAP operation.
n is 1-indexed (SWAP1 = swap top with second, SWAP2 = swap top with third).
Sourcepub fn remove(&mut self, value: ValueId) -> bool
pub fn remove(&mut self, value: ValueId) -> bool
Removes a value from the stack at any position. Used when we know a value is dead and we want to track its removal.
Trait Implementations§
Source§impl Clone for StackModel
impl Clone for StackModel
Source§fn clone(&self) -> StackModel
fn clone(&self) -> StackModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StackModel
impl Debug for StackModel
Source§impl Default for StackModel
impl Default for StackModel
Source§fn default() -> StackModel
fn default() -> StackModel
Auto Trait Implementations§
impl Freeze for StackModel
impl RefUnwindSafe for StackModel
impl Send for StackModel
impl Sync for StackModel
impl Unpin for StackModel
impl UnsafeUnpin for StackModel
impl UnwindSafe for StackModel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more