[][src]Struct adt::Stack

pub struct Stack<T> { /* fields omitted */ }

A FIFO data structure

Methods

impl<T> Stack<T>
[src]

pub fn new() -> Self
[src]

Returns a new Stack object

pub fn push(&mut self, value: T)
[src]

Pushes a value onto the Stack

Arguments

  • value - The value to push onto the Stack

pub fn pop(&mut self) -> Option<T>
[src]

Pops a value off the Stack and returns it as an Option

pub fn peek(&self) -> Option<&T>
[src]

Returns an immutable reference to the value on top of the Stack

pub fn peek_mut(&mut self) -> Option<&mut T>
[src]

Returns a mutable reference to the value on top of the Stack

pub fn size(&self) -> usize
[src]

Returns the number of items on the Stack

pub fn is_empty(&self) -> bool
[src]

Returns whether the Stack is empty

pub fn clear(&mut self)
[src]

Clears the Stack

Auto Trait Implementations

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

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

Blanket Implementations

impl<T> From for T
[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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