Heap

Trait Heap 

Source
pub trait Heap {
    type Handle;
    type Allocator;

    // Required methods
    fn create_allocator(&self) -> Self::Allocator;
    fn handle(&self) -> Self::Handle;
}
Expand description

An owned handle into a garbage collected heap. The heap should outlive

Required Associated Types§

Source

type Handle

The type of handles for this heap. The primary purpose of handles is to provide guarantee the lifetime of the heap.

Source

type Allocator

Required Methods§

Source

fn create_allocator(&self) -> Self::Allocator

Create a new allocator into this heap. It is recommended that allocators implement Send so they may be shared across threads and used as thread local allocators. Similarly to heap handles, the heap is expected to outlive all allocators.

Source

fn handle(&self) -> Self::Handle

Create a new handle for this heap. While not required, it may be beneficial to make type Handle = Self;. It is assumed that handles provide shared ownership of the heap. This may be implemented via reference counting (Ex: Arc<Self>) or as a wrapper for unsafe code.

Implementors§