Skip to main content

Module set

Module set 

Source
Expand description

The submilli Set<T> — the Rust port of the prelude’s hand-written Wasm hashset (codegen/prelude/set.rs).

Mirrors the Map port (super::map) with a single elements array instead of separate keys/values: the same $Object-subtype backing struct ($SetBacking { vtable, elements, size, order, order_len, hashes, order_positions, identity }), the same open-addressing probe, insertion-order ledger, tombstones, resize, and compaction. Storage stays in the GC heap; host fns drive the logic through the struct ABI.

Elements hash and compare through the object vtable — slot 3 (hash) and slot 2 (equals) via [dispatch_vtable_slot] — so add/has/delete (and the algebra/relation ops that probe through them) are async; size/clear and iterator construction stay sync. The tombstone sentinel ([host_map_tombstone]) is shared with Map, as are cached bucket hashes and reverse ledger positions for resize and indexed deletion.

Functions§

declare
install