std/collections/hashset
std/collections/hashset — generic HashSet<T> over the hashable
mono dimensions (i32 / i64 / string).
A SwissTable membership set — the HashMap SwissTable with the
parallel value array removed (add either inserts the element or
reports it was already present; there is nothing to store
alongside it). The meta-byte / h2 / probe machinery is identical toHashMap; see collections.axle for the full layout commentary.
meta : i8[cap + 16] — control byte per slot + 16-byte mirror.
keys : T[cap] — the elements.
Meta encoding: 0x00..0x7F occupied (low 7 bits = h2), 0x80
empty, 0xFE tombstone. Hashing dispatches statically per T via
the hash_key builtin; load factor 7/8 (len + tombstones feeds
the trigger). Rehash doubles the capacity and re-inserts the live
elements, dropping tombstones.T = f64 is unsupported: hash_key rejects floats (NaN, ±0, and
precision-as-equality are footguns), exactly as HashMap rejects
an f64 key. Collect floats in an ArrayList<f64> instead.
C class HashSet<T>
Constructors
| Type | Method and description |
|---|---|
| constructor() Build an empty set sized to one 16-slot SIMD group, its meta array (plus 16-byte mirror) splatted to the empty sentinel. |
Method detail
#constructor
Build an empty set sized to one 16-slot SIMD group, its meta
array (plus 16-byte mirror) splatted to the empty sentinel.
Methods
| Type | Method and description |
|---|---|
| size(self) : i32 |
| isEmpty(self) : bool |
| clear(mut self) : void |
| add(mut self, value : T) : bool |
| contains(self, value : T) : bool |
| remove(mut self, value : T) : bool |