revm_interpreter::interpreter_types

Trait StackTrait

Source
pub trait StackTrait {
    // Required methods
    fn len(&self) -> usize;
    fn push(&mut self, value: U256) -> bool;
    fn popn<const N: usize>(&mut self) -> Option<[U256; N]>;
    fn popn_top<const POPN: usize>(
        &mut self,
    ) -> Option<([U256; POPN], &mut U256)>;
    fn exchange(&mut self, n: usize, m: usize) -> bool;
    fn dup(&mut self, n: usize) -> bool;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn push_b256(&mut self, value: B256) -> bool { ... }
    fn top(&mut self) -> Option<&mut U256> { ... }
    fn pop(&mut self) -> Option<U256> { ... }
    fn pop_address(&mut self) -> Option<Address> { ... }
}

Required Methods§

Source

fn len(&self) -> usize

Returns stack length.

Source

fn push(&mut self, value: U256) -> bool

Pushes values to the stack Return true if push was successful, false if stack overflow.

§Note

Error is internally set in interpreter.

Source

fn popn<const N: usize>(&mut self) -> Option<[U256; N]>

Pop value from the stack.

Source

fn popn_top<const POPN: usize>(&mut self) -> Option<([U256; POPN], &mut U256)>

Pop N values from the stack and return top value.

Source

fn exchange(&mut self, n: usize, m: usize) -> bool

Exchange two values on the stack.

Indexes are based from the top of the stack.

Return true if swap was successful, false if stack underflow.

Source

fn dup(&mut self, n: usize) -> bool

Duplicates the Nth value from the top of the stack.

Index is based from the top of the stack.

Return true if duplicate was successful, false if stack underflow.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if stack is empty.

Source

fn push_b256(&mut self, value: B256) -> bool

Source

fn top(&mut self) -> Option<&mut U256>

Return top value from the stack.

Source

fn pop(&mut self) -> Option<U256>

Pop one value from the stack.

Source

fn pop_address(&mut self) -> Option<Address>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§