arena-rs

Crates.ioarena-rs
lib.rsarena-rs
version0.1.1
sourcesrc
created_at2019-12-05 20:24:44.120817
updated_at2019-12-05 20:42:44.406468
descriptionAn arena memory pool for fast heap allocations and dealocations
homepagehttps://github.com/BrokenLamp/Arena-rs
repositoryhttps://github.com/BrokenLamp/Arena-rs
max_upload_size
id186739
size5,297
Brandon Dyer (BrandonDyer64)

documentation

README

Arena-rs

Crates.io

An arena memory pool for fast Rust heap allocations and dealocations.

This allows data to be allocated instantly and destroyed in batches.

Creating an Arena

let mut arena = Arena::new(1024 /* size in bytes*/);

Allocating data

let value = arena.alloc(17)?;
assert_eq!(*value, 17);

Deallocating data

{
    let arena = Arena::new(1024);
} // <- All data in arena is deallocated here

Saftey

let arena = Arena::new(1024);
let value = arena.alloc(17)?;
move_arena(arena);
println!("{}", *value); // <- Compiler Error
// The arena was destroyed when we gave it to `move_arena`
// so we cannot use any data it gave to us
Commit count: 11

cargo fmt