Struct ts_mem_pool::memory_pool::MemoryPool [−][src]
pub struct MemoryPool<T> { /* fields omitted */ }
Memory pool structure
Methods
impl<T: Recycle> MemoryPool<T>
[src]
impl<T: Recycle> MemoryPool<T>
pub fn create_with(
size: usize,
max: usize,
creator: CreateFn<T>
) -> MemoryPool<T>
[src]
pub fn create_with(
size: usize,
max: usize,
creator: CreateFn<T>
) -> MemoryPool<T>
Constructor, must take intial size and maximum size. The creator closure is used to initialize the mem slots
Panics
This function will panic if size > max
pub fn get(&self) -> ArcRecycled<T>
[src]
pub fn get(&self) -> ArcRecycled<T>
This function returns a memory slot from the memory pool
Panics
This function will panic if it needs to allocate more than max
pub fn try_get(&self) -> Option<ArcRecycled<T>>
[src]
pub fn try_get(&self) -> Option<ArcRecycled<T>>
This function returns a memory slot from the memory pool if size does not exceed max. returns None otherwise
Auto Trait Implementations
impl<T> !Send for MemoryPool<T>
impl<T> !Send for MemoryPool<T>
impl<T> !Sync for MemoryPool<T>
impl<T> !Sync for MemoryPool<T>