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§
Sourcefn push(&mut self, value: U256) -> bool
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.
Sourcefn popn_top<const POPN: usize>(&mut self) -> Option<([U256; POPN], &mut U256)>
fn popn_top<const POPN: usize>(&mut self) -> Option<([U256; POPN], &mut U256)>
Pop N values from the stack and return top value.
Provided Methods§
fn push_b256(&mut self, value: B256) -> bool
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.