| Crates.io | stable-block-arena |
| lib.rs | stable-block-arena |
| version | 0.1.0 |
| created_at | 2026-01-08 21:19:27.752574+00 |
| updated_at | 2026-01-08 21:19:27.752574+00 |
| description | Block-allocated arena with stable handles that survive compaction |
| homepage | |
| repository | |
| max_upload_size | |
| id | 2031103 |
| size | 29,842 |
Block-allocated arena with stable handles that survive compaction
u32 wrappersuse stable_block_arena::Arena;
let mut arena = Arena::new();
let hello = arena.insert("hello");
let world = arena.insert("world");
arena.remove(hello);
// Handle is still valid!
assert_eq!(arena.get(world), Some(&"world"));
// Reclaim memory blocks from removed elements
arena.compact(|_| true);
// Handle is still valid after compaction!
assert_eq!(arena.get(world), Some(&"world"));
// Remove 'world' during compaction
arena.compact(|handle| handle != world);
// World has been removed during compaction
assert_eq!(arena.get(world), None);
Licensed under either of Apache License, Version 2.0 or MIT license at your option.