pub enum HashMapKindedRef {
I64(Arc<HashMapData<i64>>),
F64(Arc<HashMapData<f64>>),
Bool(Arc<HashMapData<u8>>),
Char(Arc<HashMapData<char>>),
String(Arc<HashMapData<*const StringObj>>),
Decimal(Arc<HashMapData<*const DecimalObj>>),
TypedObject(Arc<HashMapData<TypedObjectPtr>>),
TraitObject(Arc<HashMapData<TraitObjectPtr>>),
HashMap(Arc<HashMapData<HashMapKindedRef>>),
}Expand description
HashMapKindedRef — kinded carrier for Arc<HashMapData<V>> per audit
§C.4 option (a.2). Bundles per-V monomorphized payload types as enum
variants; the variant tag IS the NativeKind discriminator at the
carrier layer.
Used as the HeapValue::HashMap arm payload (ckpt-2 flips the variant
signature). Stays within shape-value / shape-runtime / shape-vm internal
Rust boundaries per ADR-006 §2.7.5 Cross-crate ABI policy — does NOT
leak into the extension contract raw-bits ABI at module_exports.rs:21.
Manual Drop + Clone discipline mirroring TypedObjectPtr: the
auto-derived Drop / Clone on the enclosing HeapValue enum chains
through HashMapKindedRef’s manual impls, which dispatch to per-variant
Arc::drop / Arc::clone on the typed inner Arc<HashMapData<V>>.
Per-V variants supported at landing (mirror of §C.4 audit shape; post-D4 TypedObjectPtr canonical pattern):
I64—Arc<HashMapData<i64>>F64—Arc<HashMapData<f64>>Bool—Arc<HashMapData<u8>>Char—Arc<HashMapData<char>>(dead-but-derived per §C.5)String—Arc<HashMapData<*const StringObj>>Decimal—Arc<HashMapData<*const DecimalObj>>TypedObject—Arc<HashMapData<TypedObjectPtr>>TraitObject—Arc<HashMapData<TraitObjectPtr>>
Forbidden (per CLAUDE.md broader-family regex + Q25.B SUPERSEDED post-supersession #1):
- “HashMapKindedRef shim” / “HashMapKindedRef bridge” / “kinded-ref helper”
framing — refused on sight; the Ref-suffix is canonical per ADR-006
§2.7.6 / Q8 carrier-API-bound naming. Mirror of
KindedSlot::from_Xconstructor-shape; not a shim. - Re-introducing
HashMapValueBufarms inside or alongside this enum (“Q25.B-inside-enum carriers retained” / “documented intentional duality”). The Wave 2 cadence shift authorization stands — per-V monomorphization at the method tier with HashMapKindedRef carrier is the deletion target, NOT a preserved-alongside alternative. - HashMap-wide runtime kind discriminator on
HashMapData<V>itself (per audit §C.4 rationale: per-V monomorphization at compile time via this carrier API; NO inline tag byte onHashMapData<V>).
Variants§
I64(Arc<HashMapData<i64>>)
Arc<HashMapData<i64>> — V = i64 (POD scalar).
F64(Arc<HashMapData<f64>>)
Arc<HashMapData<f64>> — V = f64 (POD scalar).
Bool(Arc<HashMapData<u8>>)
Arc<HashMapData<u8>> — V = u8 (Bool; one byte per element).
Char(Arc<HashMapData<char>>)
Arc<HashMapData<char>> — V = char (codepoint; dead-but-derived per §C.5).
String(Arc<HashMapData<*const StringObj>>)
Arc<HashMapData<*const StringObj>> — V = *const StringObj
(HeapElement-equipped raw pointer).
Decimal(Arc<HashMapData<*const DecimalObj>>)
Arc<HashMapData<*const DecimalObj>> — V = *const DecimalObj
(HeapElement-equipped raw pointer).
TypedObject(Arc<HashMapData<TypedObjectPtr>>)
Arc<HashMapData<TypedObjectPtr>> — V = TypedObjectPtr
(#[repr(transparent)] newtype over *const TypedObjectStorage,
per ADR-006 §2.3 amendment D4 ckpt-final-prime² canonical pattern).
TraitObject(Arc<HashMapData<TraitObjectPtr>>)
Arc<HashMapData<TraitObjectPtr>> — V = TraitObjectPtr
(#[repr(transparent)] newtype over *const TraitObjectStorage).
HashMap(Arc<HashMapData<HashMapKindedRef>>)
Arc<HashMapData<HashMapKindedRef>> — V = HashMapKindedRef itself
(recursive carrier). The inner HashMaps’ values buffer is a flat
array of HashMapKindedRef payloads (per-V kinded refs, each
holding its own Arc<HashMapData<V_inner>>). Used by
HashMap.groupBy to produce HashMap<string, HashMap> outputs.
Wave N hashmap-value-v-arm follow-up (cluster-2 closure-wave-C,
2026-05-16). Per ADR-006 §2.7.24 Q25.B SUPERSEDED canonical
pattern (HashMapKindedRef carrier + per-V monomorphization at
the method tier) extended naturally to a recursive HashMap-value
V arm via the existing HashMapValueElem trait dispatch shape.
Implementations§
Source§impl HashMapKindedRef
impl HashMapKindedRef
Sourcepub fn values_kind(&self) -> NativeKind
pub fn values_kind(&self) -> NativeKind
The per-V NativeKind discriminator for the values buffer of this
HashMap. Used at carrier boundaries (e.g. HashMap.values()
projection to TypedArrayData::<V> arm + the parallel-kind stack
track at §2.7.7 / Q9 stack reads of HashMap-iter yields) to feed
the per-V Arc into the matching KindedSlot::from_* constructor.
Per ADR-006 §2.7.6 / Q8 carrier-API-bound rule: one accessor per
NativeKind heap variant — no per-V escape-hatch accessor (e.g.
as_string_arc() returning Arc<HashMapData<*const StringObj>>)
at this layer; consumers destructure the enum to recover the
typed inner Arc.
Per-V NativeKind mapping (Wave 2 Round 3b C2-joint ckpt-2 2026-05-14):
I64→NativeKind::Int64F64→NativeKind::Float64Bool→NativeKind::BoolChar→NativeKind::Char(dead-but-derived per §C.5)String→NativeKind::Ptr(HeapKind::String)Decimal→NativeKind::Ptr(HeapKind::Decimal)TypedObject→NativeKind::Ptr(HeapKind::TypedObject)TraitObject→NativeKind::Ptr(HeapKind::TraitObject)HashMap→NativeKind::Ptr(HeapKind::HashMap)(recursive carrier; Wave N hashmap-value-v-arm follow-up 2026-05-16)
StringV2 / DecimalV2 gate-flip dependency note: at ckpt-2
landing time (2026-05-14), the v2-raw StringV2 / DecimalV2
NativeKind variants were proposed in Round 3a’ but the
gate-flip from NativeKind::Ptr(HeapKind::String) →
NativeKind::StringV2 (et al.) had not propagated across all
carrier APIs. This accessor maps String and Decimal arms to
the heap-pointer variant per the post-3a-flip baseline; if a
future gate-flip moves the canonical surface to StringV2/DecimalV2,
this mapping is updated lockstep at the same wave (ckpt-3 or
follow-up).
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of entries in the HashMap. Dispatches per-V to the inner
HashMapData<V>::len() (same impl for every V — the keys buffer
length, which equals the values buffer length per the from_pairs
invariant).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the map is empty (zero entries). Dispatches per-V via len().
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Whether the map contains the given key. Dispatches per-V via the
inner HashMapData<V>::contains_key (same impl for every V — keys
are stringly-typed, so the lookup is V-agnostic).
Sourcepub const fn heap_kind(&self) -> HeapKind
pub const fn heap_kind(&self) -> HeapKind
The HeapKind discriminator for KindedSlot::from_hashmap slot
stamping (§2.7.6 / Q8 / Q9 parallel-kind track). Always
HeapKind::HashMap regardless of the inner V — the V-discriminator
is encoded in the HashMapKindedRef variant tag, not in the
HeapKind ordinal (HashMap stays at ordinal 17).
Trait Implementations§
Source§impl Clone for HashMapKindedRef
impl Clone for HashMapKindedRef
Source§impl Debug for HashMapKindedRef
impl Debug for HashMapKindedRef
Source§impl HashMapValueElem for HashMapKindedRef
impl HashMapValueElem for HashMapKindedRef
Source§unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
HashMapKindedRef is non-Copy with an auto-derived Drop (each
variant holds Arc<HashMapData<V>> whose Drop retires one
strong-count share). Walk the buffer via ptr::read to invoke
each element’s Drop, then free the data allocation + struct.
Mirror of the TypedObjectPtr / TraitObjectPtr impl shape.
Source§unsafe fn release_owned(_value: Self)
unsafe fn release_owned(_value: Self)
release_elem on the pointer. For Ptr-newtype
V the wrapper’s Drop runs automatically when the value drops. Read more