DirectAllocPool

Type Alias DirectAllocPool 

Source
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>

Source

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.

Trait Implementations§

Source§

impl<T: Clone, H: Handle> Clone for DirectAllocPool<T, H>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more