pub struct Stack { /* private fields */ }Expand description
Bounded script stack with Core’s 1000-item maximum depth.
Implementations§
Source§impl Stack
impl Stack
Sourcepub const MAX_DEPTH: usize = 1000
pub const MAX_DEPTH: usize = 1000
Maximum stack depth permitted by consensus script evaluation.
Sourcepub fn push(&mut self, item: ScriptItem) -> Result<(), StackError>
pub fn push(&mut self, item: ScriptItem) -> Result<(), StackError>
Pushes one item, rejecting capacity overflow instead of panicking.
Sourcepub fn pop(&mut self) -> Result<ScriptItem, StackError>
pub fn pop(&mut self) -> Result<ScriptItem, StackError>
Pops the top item.
Sourcepub fn peek(&self) -> Result<&ScriptItem, StackError>
pub fn peek(&self) -> Result<&ScriptItem, StackError>
Returns the top item without removing it.
Trait Implementations§
impl Eq for Stack
impl StructuralPartialEq for Stack
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnsafeUnpin for Stack
impl UnwindSafe for Stack
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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