Skip to main content

GCAllocator

Trait GCAllocator 

pub trait GCAllocator<T: Default>: Send + Sync {
    // Required methods
    fn add(&self, element: T) -> GCArc<T>;
    fn allocated_count(&self) -> usize;
    fn available_allocated_count(&self) -> usize;
}
Expand description

Trait that defines the basic operations of a GCAllocator and should be implemented by every allocator.

Required Methods§

fn add(&self, element: T) -> GCArc<T>

Adds a new element to the allocator, if the allocator is full it will allocate a new block of memory.

fn allocated_count(&self) -> usize

Returns the number of allocated elements

fn available_allocated_count(&self) -> usize

Returns the number of available allocated elements

Implementors§

§

impl<T: Default + 'static> GCAllocator<T> for DynamicReusableAllocator<T>