This Rust module provides a memory allocation Arena for types that implement Copy.
Examples
extern crate copy_arena;
use Arena;
let mut arena = new;
let mut allocator = arena.allocator;
let a: &mut i32 = allocator.alloc;
let b: &mut f64 = allocator.alloc_default;
let c: &mut = allocator.alloc_slice;
let b: &mut = allocator.alloc_slice_fn;
let e: &mut = allocator.alloc_slice_default;
Compared to std::arena::Arena
This differs from the (unstable) Arena in Rust's standard library in a couple of ways:
- This Arena only supports
Copy
-able objects -- no destructors are executed. - This Arena does not use dynamic borrow checking, saving two RefCells and an Rc before getting to the underlying data to allocate from but leading to a slightly less convenient API.