[−][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]
pub fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = (usize, &'a mut T)>
[src]
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<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]
impl<'de, T> Deserialize<'de> for Pool<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<L, T> From<L> for Pool<T> where
L: IntoIterator<Item = T>,
[src]
L: IntoIterator<Item = T>,
impl<T> Index<usize> for Pool<T>
[src]
impl<T> IndexMut<usize> for Pool<T>
[src]
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> Serialize for Pool<T> where
T: Serialize,
[src]
T: Serialize,
Auto Trait Implementations
impl<T> RefUnwindSafe for Pool<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Pool<T> where
T: Send,
T: Send,
impl<T> Sync for Pool<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Pool<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Pool<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,