Trait StackTr
pub trait StackTr {
// Required methods
fn len(&self) -> usize;
fn push(&mut self, value: Uint<256, 4>) -> bool;
fn popn<const N: usize>(&mut self) -> Option<[Uint<256, 4>; N]>;
fn popn_top<const POPN: usize>(
&mut self,
) -> Option<([Uint<256, 4>; POPN], &mut Uint<256, 4>)>;
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: FixedBytes<32>) -> bool { ... }
fn top(&mut self) -> Option<&mut Uint<256, 4>> { ... }
fn pop(&mut self) -> Option<Uint<256, 4>> { ... }
fn pop_address(&mut self) -> Option<Address> { ... }
}
Expand description
Functions needed for Interpreter Stack operations.
Required Methods§
fn push(&mut self, value: Uint<256, 4>) -> bool
fn push(&mut self, value: Uint<256, 4>) -> bool
Pushes values to the stack.
Returns true
if push was successful, false
if stack overflow.
§Note
Error is internally set in interpreter.
fn popn_top<const POPN: usize>(
&mut self,
) -> Option<([Uint<256, 4>; POPN], &mut Uint<256, 4>)>
fn popn_top<const POPN: usize>( &mut self, ) -> Option<([Uint<256, 4>; POPN], &mut Uint<256, 4>)>
Pop N values from the stack and return top value.
Provided Methods§
fn push_b256(&mut self, value: FixedBytes<32>) -> bool
fn push_b256(&mut self, value: FixedBytes<32>) -> bool
Pushes B256 value to the stack.
Internally converts B256 to U256 and then calls StackTr::push
.
fn pop_address(&mut self) -> Option<Address>
fn pop_address(&mut self) -> Option<Address>
Pops address from the stack.
Internally call StackTr::pop
and converts U256
into 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.