Struct Stack

struct Stack<T: Clone> { ... }

Implementation of a Stack which maintains popped elements and length of previous states in order to rewind the stack to a previous state.

Implementations

impl<T: Clone> Stack<T>

fn new() -> Self

Creates a new Stack.

fn is_empty(self: &Self) -> bool

Returns true if the stack is currently empty.

fn peek(self: &Self) -> Option<&T>

Returns the top-most &T in the Stack.

fn push(self: &mut Self, elem: T)

Pushes a T onto the Stack.

fn pop(self: &mut Self) -> Option<T>

Pops the top-most T from the Stack.

fn len(self: &Self) -> usize

Returns the size of the stack

fn snapshot(self: &mut Self)

Takes a snapshot of the current Stack.

fn clear_snapshot(self: &mut Self)

The parsing after the last snapshot was successful so clearing it.

fn restore(self: &mut Self)

Rewinds the Stack to the most recent snapshot(). If no snapshot() has been taken, this function return the stack to its initial state.

impl<T> Any for Stack<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Stack<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Stack<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> Freeze for Stack<T>

impl<T> From for Stack<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for Stack<T>

impl<T> Send for Stack<T>

impl<T> Sync for Stack<T>

impl<T> Unpin for Stack<T>

impl<T> UnsafeUnpin for Stack<T>

impl<T> UnwindSafe for Stack<T>

impl<T, U> Into for Stack<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Stack<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Stack<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::fmt::Debug + Clone> Debug for Stack<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: Clone> Default for Stack<T>

fn default() -> Self

impl<T: Clone> Index for Stack<T>

fn index(self: &Self, range: Range<usize>) -> &[T]