Module pool

Expand description

See pool for the system contract and examples. Bounded reusable object slots with generation-checked handles.

Handles are scoped to the originating pool: callers must not use them with another pool, since pool identity is not stored or checked. Removing a value invalidates its handle; exhausted generations permanently retire a slot.

Pool::capacity is the configured slot limit, while Pool::available counts slots that can still accept values, excluding retired slots. Storage grows lazily: insertion can grow the slot vector, and removal (including Pool::retain and Pool::clear) can grow the reusable-index vector. Neither vector is shrunk on removal, so subsequent reuse within their warmed capacities does not allocate pool storage. Iteration allocates no storage. Selected mutable access through Pool::get2_mut or Pool::get_many_mut also allocates no storage, even before the reusable-index vector is warmed.

Structs§

Handle
A generation-checked reference to a value in its originating Pool.
Pool
A lazily allocated pool with a fixed slot limit and stable live handles.

Enums§

PoolAccessError
A failed selection for Pool::get2_mut or Pool::get_many_mut.