pub trait EvmStack: Debug {
type Word: EvmWord;
// Required methods
fn size(&self) -> usize;
fn peek(&self, n: usize) -> &Self::Word;
fn push(&mut self, item: Self::Word);
fn pop(&mut self) -> Self::Word;
fn set(&mut self, n: usize, item: Self::Word) -> Self::Word;
fn goto(&mut self, pc: usize);
// Provided methods
fn has_capacity(&self, n: usize) -> bool { ... }
fn has_operands(&self, n: usize) -> bool { ... }
fn swap(&mut self, n: usize) { ... }
fn dup(&mut self, n: usize) { ... }
}
Expand description
Abstraction of the operand stack within an EVM. This provides the minimal set of operations required to implement the semantics of a given bytecode instruction. For example, pushing / popping items from the stack.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn has_capacity(&self, n: usize) -> bool
fn has_capacity(&self, n: usize) -> bool
Check capacity for n
additional items on the stack.
sourcefn has_operands(&self, n: usize) -> bool
fn has_operands(&self, n: usize) -> bool
Check at least n
operands on the stack.