pub struct TypePools<H = RandomState> { /* private fields */ }
Expand description
A collection of pools or arrays that contain values of a specific type
Implementations§
Source§impl TypePools
impl TypePools
pub fn new() -> Self
Sourcepub fn type_pool_mut<T: 'static>(&mut self) -> Option<&mut TypePool<T>>
pub fn type_pool_mut<T: 'static>(&mut self) -> Option<&mut TypePool<T>>
Get a mutable reference to a type pool
Sourcepub fn push<T: 'static>(&mut self, value: T)
pub fn push<T: 'static>(&mut self, value: T)
Add a value to the pools. If the type pool doesn’t exst yet, it will be created
Sourcepub fn pop<T: 'static>(&mut self) -> Option<T>
pub fn pop<T: 'static>(&mut self) -> Option<T>
Returns the popped item or None
if the value doesn’t exist
Sourcepub fn remove<T: 'static>(&mut self, idx: usize) -> Option<T>
pub fn remove<T: 'static>(&mut self, idx: usize) -> Option<T>
Remove the value at the index in the type pool specified by T
Sourcepub fn get_mut<T: 'static>(&mut self, idx: usize) -> Option<&mut T>
pub fn get_mut<T: 'static>(&mut self, idx: usize) -> Option<&mut T>
Get a mutable reference to a value in a TypePool
pub fn len<T: 'static>(&self) -> Option<usize>
Sourcepub fn types_count(&self) -> usize
pub fn types_count(&self) -> usize
The amount of types stored in pools
Sourcepub fn remove_type<T: 'static>(&mut self)
pub fn remove_type<T: 'static>(&mut self)
Remove all entries for a type
Sourcepub fn remove_empty(&mut self)
pub fn remove_empty(&mut self)
Remove all types which do not contain any values
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrink the array containing all the pools to fit
Auto Trait Implementations§
impl<H> Freeze for TypePools<H>where
H: Freeze,
impl<H = RandomState> !RefUnwindSafe for TypePools<H>
impl<H = RandomState> !Send for TypePools<H>
impl<H = RandomState> !Sync for TypePools<H>
impl<H> Unpin for TypePools<H>where
H: Unpin,
impl<H = RandomState> !UnwindSafe for TypePools<H>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more