Expand description
A push-only vector that grows in fixed-size chunks instead of one contiguous reallocating buffer.
The trade-off vs. Vec:
- One pointer indirection per indexed access (chunk lookup โ element).
- Slightly larger per-element overhead from chunk pointers (negligible at 64K elements/chunk).
- References returned by
index/index_mutare stable acrosspush(a future-useful property; not currently relied on).
API is intentionally minimal โ only the operations the trace server
needs (push, len, indexed access, get, truncate).
Structsยง
Constantsยง
- CHUNK_
SIZE ๐ - Number of elements per chunk. Power of two so
idx / CHUNK_SIZEandidx % CHUNK_SIZEcompile to a shift and a mask.
Functionsยง
- new_
chunk ๐ - Allocate a fresh chunk on the heap without ever materializing a
CHUNK_SIZE-element array on the stack. - split_
index ๐ - Returns the chunk index and intra-chunk offset for an element index.
Type Aliasesยง
- Chunk ๐