pub struct Stack<T: Stackable>(_);
Expand description
An owned stack of T
.
Implementations
Methods from Deref<Target = StackRef<T>>
pub fn iter(&self) -> Iter<'_, T>ⓘNotable traits for Iter<'a, T>impl<'a, T: Stackable> Iterator for Iter<'a, T> type Item = &'a T::Ref;
pub fn iter_mut(&mut self) -> IterMut<'_, T>ⓘNotable traits for IterMut<'a, T>impl<'a, T: Stackable> Iterator for IterMut<'a, T> type Item = &'a mut T::Ref;
sourcepub fn get(&self, idx: usize) -> Option<&T::Ref>
pub fn get(&self, idx: usize) -> Option<&T::Ref>
Returns a reference to the element at the given index in the
stack or None
if the index is out of bounds
sourcepub fn get_mut(&mut self, idx: usize) -> Option<&mut T::Ref>
pub fn get_mut(&mut self, idx: usize) -> Option<&mut T::Ref>
Returns a mutable reference to the element at the given index in the
stack or None
if the index is out of bounds
sourcepub fn push(&mut self, data: T) -> Result<(), ErrorStack>
pub fn push(&mut self, data: T) -> Result<(), ErrorStack>
Pushes a value onto the top of the stack.
Trait Implementations
sourceimpl<T: Stackable> ForeignType for Stack<T>
impl<T: Stackable> ForeignType for Stack<T>
sourceimpl<'a, T: Stackable> IntoIterator for &'a Stack<T>
impl<'a, T: Stackable> IntoIterator for &'a Stack<T>
type Item = &'a <T as ForeignType>::Ref
type Item = &'a <T as ForeignType>::Ref
The type of the elements being iterated over.
sourceimpl<'a, T: Stackable> IntoIterator for &'a mut Stack<T>
impl<'a, T: Stackable> IntoIterator for &'a mut Stack<T>
type Item = &'a mut <T as ForeignType>::Ref
type Item = &'a mut <T as ForeignType>::Ref
The type of the elements being iterated over.
sourceimpl<T: Stackable> IntoIterator for Stack<T>
impl<T: Stackable> IntoIterator for Stack<T>
type Item = T
type Item = T
The type of the elements being iterated over.
impl<T: Stackable + Send> Send for Stack<T>
impl<T: Stackable + Sync> Sync for Stack<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Stack<T>where
<T as Stackable>::StackType: RefUnwindSafe,
impl<T> Unpin for Stack<T>
impl<T> UnwindSafe for Stack<T>where
<T as Stackable>::StackType: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more