Skip to main content

Crate subms_arena_allocator

Crate subms_arena_allocator 

Source
Expand description

Bump-pointer arena. Allocate fixed-layout values into a growing byte buffer; reset() rewinds the bump cursor so the next request can reuse the entire arena.

Important: Drop is NOT run on items in the arena. Anything with a non-trivial Drop (e.g. String, Vec) will leak its heap allocation if you store it in this arena. See Bump::alloc_copy which is constrained to Copy types as the safe public surface.

use subms_arena_allocator::Bump;
let mut a = Bump::with_capacity(1024);
let x: &mut u32 = a.alloc_copy(42u32);
assert_eq!(*x, 42);
a.reset();

Structsยง

Bump
Bump-pointer arena.