[−][src]Struct dynstack::DynStack
Methods
impl<T: ?Sized> DynStack<T>
[src]
pub fn new() -> Self
[src]
pub unsafe fn push(&mut self, item: *mut T)
[src]
Push a trait object onto the stack.
This method is unsafe because in lieu of moving a trait object onto push
's stack
(not possible in rust as of 1.30.0) we copy it from the provided mutable pointer.
The user of this method must therefore either ensure that item
has no Drop
impl,
or explicitly call std::mem::forget
on item
after pushing.
It is highly recommended to use the dyn_push
macro instead of calling this directly.
pub fn remove_last(&mut self) -> bool
[src]
Remove the last trait object from the stack. Returns true if any items were removed.
pub fn get<'a>(&'a self, index: usize) -> Option<&'a T>
[src]
Retrieve a trait object reference at the provided index.
pub fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut T>
[src]
Retrieve a mutable trait object reference at the provided index.
pub fn peek<'a>(&'a self) -> Option<&'a T>
[src]
Retrieve the trait object reference at the top of the stack.
pub fn peek_mut<'a>(&'a mut self) -> Option<&'a mut T>
[src]
Retrieve the mutable trait object reference at the top of the stack.
pub fn len(&self) -> usize
[src]
Returns the number of trait objects stored on the stack.
impl<'a, T: 'a + ?Sized> DynStack<T>
[src]
ⓘImportant traits for DynStackIter<'a, T>pub fn iter(&'a self) -> DynStackIter<'a, T>
[src]
Returns an iterator over trait object references
ⓘImportant traits for DynStackIterMut<'a, T>pub fn iter_mut(&'a mut self) -> DynStackIterMut<'a, T>
[src]
Returns an iterator over mutable trait object references
Trait Implementations
impl<'a, T: 'a + ?Sized> IntoIterator for &'a DynStack<T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = DynStackIter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T: 'a + ?Sized> IntoIterator for &'a mut DynStack<T>
[src]
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = DynStackIterMut<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: ?Sized> Drop for DynStack<T>
[src]
impl<T: ?Sized> Index<usize> for DynStack<T>
[src]
impl<T: ?Sized> IndexMut<usize> for DynStack<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,