Arena allocator - Rust
Bump-pointer arena with chunked growth and reset() for per-request reuse. Allocate is ~10 ns; reset is constant-time.
Part of the submillisecond.com cookbook. Zero external dependencies; std only.
Install
[]
= "0.4"
Quickstart
Public API
pub struct Bumppub fn new() -> Selfpub fn with_capacity(initial_bytes: usize) -> Selfpub fn alloc_copy<T: Copy>(&mut self, value: T) -> &mut Tpub fn alloc_raw(&mut self, layout: Layout) -> *mut u8pub fn reset(&mut self)pub fn total_capacity(&self) -> usize
Files
src/lib.rs- implementation.tests/- integration tests; correctness, edge cases, property/stress.examples/demo.rs- stdout walkthrough.examples/perf_main.rs- bench entry (behind theharnessfeature).
License
Dual-licensed under MIT OR Apache-2.0.