[][src]Struct dark_vm::utils::stack::Stack

pub struct Stack<T: Debug + PartialEq>(pub Vec<T>);

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

impl<T: Debug + PartialEq> Debug for Stack<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Stack<T> where
    T: RefUnwindSafe

impl<T> Send for Stack<T> where
    T: Send

impl<T> Sync for Stack<T> where
    T: Sync

impl<T> Unpin for Stack<T> where
    T: Unpin

impl<T> UnwindSafe for Stack<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.