Expand description
Fixed-capacity bump-pointer arena. Allocate fixed-layout values into a
single pre-sized byte buffer; reset() rewinds the bump cursor so the
next request can reuse the entire arena.
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. Bump::alloc_copy is constrained to Copy types as
the safe public surface.
Base is single-chunk and fixed-capacity. When the chunk is exhausted
alloc_* panics and try_alloc_* returns None. Opt into the
growable feature for the auto-grow variant.
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
- Fixed-capacity bump-pointer arena.