pub type DirectAllocPool<T, H = DefaultHandle> = DirectPool<T, AllocStorage<DirectPoolLayout<T, H>>, H>;Available on crate feature
alloc only.Expand description
A direct-mapped pool that stores its content in globally allocated memory.
§Examples
let mut pool = DirectAllocPool::<u128>::with_capacity(4);
assert_eq!(pool.capacity(), 4);
pool.insert(1);
pool.insert(2);
pool.insert(3);
pool.insert(4);
assert_eq!(pool.try_insert(5), Err(5));Aliased Type§
pub struct DirectAllocPool<T, H = DefaultHandle> { /* private fields */ }Implementations§
Source§impl<T, H: Handle> DirectAllocPool<T, H>
impl<T, H: Handle> DirectAllocPool<T, H>
Sourcepub fn with_capacity(capacity: H::Index) -> Self
pub fn with_capacity(capacity: H::Index) -> Self
Constructs a new, empty DirectAllocPool
with the specified capacity.
§Panics
Panics if the specified capacity is greater than or equal to H::MAX_INDEX.