Struct stack_dst::StackA
[−]
[src]
pub struct StackA<T: ?Sized, D: DataBuf> { /* fields omitted */ }
A fixed-capacity stack that can contain dynamically-sized types
Uses an array of usize as a backing store for a First-In, Last-Out stack
of items that can unsize to T
.
Note: Each item in the stack takes at least one usize
(to store the metadata)
Methods
impl<T: ?Sized, D: DataBuf> StackA<T, D>
[src]
pub fn new() -> StackA<T, D>
[src]
Construct a new (empty) stack
pub fn is_empty(&self) -> bool
[src]
Tests if the stack is empty
pub fn push<U: Unsize<T>>(&mut self, v: U) -> Result<(), U>
[src]
Push a value at the top of the stack
pub fn top(&self) -> Option<&T>
[src]
Returns a pointer to the top item on the stack
pub fn top_mut(&mut self) -> Option<&mut T>
[src]
Returns a pointer to the top item on the stack (unique/mutable)
pub fn pop(&mut self)
[src]
Pop the top item off the stack
impl<D: DataBuf> StackA<str, D>
[src]
pub fn push_str(&mut self, v: &str) -> Result<(), ()>
[src]
Push the contents of a string slice as an item onto the stack
impl<D: DataBuf, T: Clone> StackA<[T], D>
[src]
pub fn push_cloned(&mut self, v: &[T]) -> Result<(), ()>
[src]
Pushes a set of items (cloning out of the input slice)