[−][src]Struct mgf::Pool
Growable array type that allows items to be removed and inserted without changing the indices of other entries.
Methods
impl<T> Pool<T>
[src]
pub fn new() -> Self
[src]
Create an empty Pool.
pub fn with_capacity(cap: usize) -> Self
[src]
Create an empty Pool large enough to fix cap items.
pub fn empty(&self) -> bool
[src]
Determines if the Pool is empty.
pub fn len(&self) -> usize
[src]
Returns the number of occupied slots in the pool.
pub fn clear(&mut self)
[src]
Removes all entries from the pool.
pub fn push(&mut self, item: T) -> usize
[src]
Push a new item to the pool. Attempts to use spots left empty from removed items before performing a heap allocation.
pub fn remove(&mut self, i: usize) -> T
[src]
Marks an index as empty and adds it to the free list, allowing the spot to be reclaimed later.
pub fn next_free(&self) -> Option<usize>
[src]
Returns the next available id for reuse if one exists.
pub fn iter<'a>(
&'a self
) -> impl Iterator<Item = (usize, &'a T)>
[src]
&'a self
) -> impl Iterator<Item = (usize, &'a T)>
pub fn iter_mut<'a>(
&'a mut self
) -> impl Iterator<Item = (usize, &'a mut T)>
[src]
&'a mut self
) -> impl Iterator<Item = (usize, &'a mut T)>
pub fn get<'a>(&'a self, i: usize) -> Option<&'a T>
[src]
Returns a reference to an object at the given index and None if it is unoccupied.
pub fn get_mut<'a>(&'a mut self, i: usize) -> Option<&'a mut T>
[src]
Returns a mutable reference to an object at the given index and None if it is unoccupied.
Trait Implementations
impl<L, T> From<L> for Pool<T> where
L: IntoIterator<Item = T>,
[src]
L: IntoIterator<Item = T>,
impl<T> Clone for Pool<T> where
T: Clone,
[src]
T: Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a, T> IntoIterator for &'a Pool<T>
[src]
type Item = (usize, &'a T)
The type of the elements being iterated over.
type IntoIter = FilterMap<Enumerate<Iter<'a, PoolEntry<T>>>, fn(_: (usize, &PoolEntry<T>)) -> Option<(usize, &T)>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T> IntoIterator for &'a mut Pool<T>
[src]
type Item = (usize, &'a mut T)
The type of the elements being iterated over.
type IntoIter = FilterMap<Enumerate<IterMut<'a, PoolEntry<T>>>, fn(_: (usize, &mut PoolEntry<T>)) -> Option<(usize, &mut T)>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T> Index<usize> for Pool<T>
[src]
impl<T> IndexMut<usize> for Pool<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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>,