[−][src]Struct dark_vm::utils::stack::Stack
Implementations
impl<T: Debug + PartialEq> Stack<T>[src]
pub fn new() -> Stack<T>[src]
Constructs an empty stack.
pub fn push(&mut self, value: T)[src]
This function pushes the given value on to the stack.
Arguments
value - The value to push on to the stack.
pub fn pop(&mut self, pos: usize) -> Result<T, Error>[src]
This function pop the top value on to the stack. This may result in an error if the stack is empty.
Arguments
pos - The position where the pop was called. This is used if there was error.
pub fn peek(&self) -> Option<&T>[src]
This function returns a reference to the top value on the stack, without consuming it. If the stack is empty, None is returned.
pub fn peek_mut(&mut self) -> Option<&mut T>[src]
This function returns a reference to the top value on the stack, without consuming it. If the stack is empty, None is returned.
pub fn is_empty(&self) -> bool[src]
This function returns true if there are no elements in the stack.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Stack<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Stack<T> where
T: Send,
T: Send,
impl<T> Sync for Stack<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Stack<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Stack<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,