pub struct ExecutionStack { /* private fields */ }Implementations§
Source§impl ExecutionStack
impl ExecutionStack
Sourcepub fn new(items: Vec<StackItem>) -> Self
pub fn new(items: Vec<StackItem>) -> Self
Return a new ExecutionStack using the vector of StackItem in items
Sourcepub fn peek(&self) -> Option<&StackItem>
pub fn peek(&self) -> Option<&StackItem>
Returns a reference to the top entry in the stack without affecting the stack
Sourcepub fn pop(&mut self) -> Option<StackItem>
pub fn pop(&mut self) -> Option<StackItem>
Pops the top item in the stack. If the stack is not empty, pop returns the item, otherwise return None if
it is empty.
Sourcepub fn pop_into_number<T: TryFrom<i64>>(&mut self) -> Result<T, ScriptError>
pub fn pop_into_number<T: TryFrom<i64>>(&mut self) -> Result<T, ScriptError>
Pops the top item in the stack and applies TryFrom for the given generic type. If the stack is not empty, and is
a StackItem::Number, pop_into_number returns the parsed number. Returns an error if the stack is empty or if
the top item is a different variant.
Sourcepub fn pop_n_plus_one_contains(&mut self, n: u8) -> Result<bool, ScriptError>
pub fn pop_n_plus_one_contains(&mut self, n: u8) -> Result<bool, ScriptError>
Pops n + 1 items from the stack. Checks if the last popped item matches any of the first n items. Returns an error if all n + 1 items aren’t of the same variant, or if there are not n + 1 items on the stack.
Sourcepub fn pop_num_items(
&mut self,
num_items: usize,
) -> Result<Vec<StackItem>, ScriptError>
pub fn pop_num_items( &mut self, num_items: usize, ) -> Result<Vec<StackItem>, ScriptError>
Pops the top n items in the stack. If the stack has at least n items, pop_num_items returns the items in stack
order (ie. bottom first), otherwise returns an error.
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ScriptError>
Trait Implementations§
Source§impl BorshDeserialize for ExecutionStack
impl BorshDeserialize for ExecutionStack
fn deserialize_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for ExecutionStack
impl BorshSerialize for ExecutionStack
Source§impl Clone for ExecutionStack
impl Clone for ExecutionStack
Source§fn clone(&self) -> ExecutionStack
fn clone(&self) -> ExecutionStack
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExecutionStack
impl Debug for ExecutionStack
Source§impl Default for ExecutionStack
impl Default for ExecutionStack
Source§fn default() -> ExecutionStack
fn default() -> ExecutionStack
Source§impl<'de> Deserialize<'de> for ExecutionStack
impl<'de> Deserialize<'de> for ExecutionStack
Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Hex for ExecutionStack
impl Hex for ExecutionStack
Source§impl PartialEq for ExecutionStack
impl PartialEq for ExecutionStack
Source§impl Serialize for ExecutionStack
impl Serialize for ExecutionStack
impl Eq for ExecutionStack
impl StructuralPartialEq for ExecutionStack
Auto Trait Implementations§
impl Freeze for ExecutionStack
impl RefUnwindSafe for ExecutionStack
impl Send for ExecutionStack
impl Sync for ExecutionStack
impl Unpin for ExecutionStack
impl UnwindSafe for ExecutionStack
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> 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