pub fn eq_element(a_bits: u64, b_bits: u64, elem_type: V2ElemType) -> boolExpand description
Per-kind value equality for the (bits, kind) carrier shape.
Returns true iff (a_bits, kind) and (b_bits, kind) denote the
same value under the kind’s semantics. Returns false when either
pointer is null for a heap-element kind (defensive — the dispatch
shell rejects null receivers earlier, but the primitive must stay
sound under any input).
Float semantics: bitwise equality (NOT ==). This is the
IEEE-754-pure choice — NaN == NaN is false under == but true
under bitwise compare. The choice matches the includes / indexOf
observable: a NaN element pushed into the array IS findable via the
same NaN bit pattern (the array doesn’t lose track of its own
elements). The user can still write a custom predicate via
find(|x| x != x) when IEEE compare is desired.
String / Decimal: deref through the v2-raw StringObj / DecimalObj
carrier and compare content (StringObj::as_str → &str equality;
DecimalObj::value → Decimal PartialEq).
TypedObject: deep field-by-field comparison. The two objects are
equal iff (a) they share the same schema_id, (b) they share the
same per-field NativeKind table, and (c) every per-field slot
compares equal under the slot’s NativeKind via a recursive
eq_element call on the slot bits. Per ADR-006 §2.7.16 typed-Arc
dispatch-label receiver-recovery: the comparison reads the storage
directly via &*(p as *const TypedObjectStorage) (no Box-wrap
reinterpret).
§Safety
The caller must uphold the §2.7.5 producer-side stamp invariant —
for heap-element kinds (StringV2 / DecimalV2 /
Ptr(HeapKind::TypedObject)), the bits must be either 0 (null) or
a live carrier pointer of the matching T. The bits == 0 early-out
is the defensive bound; otherwise the deref is sound under the
construction-side contract upheld by every producer in this module.