Skip to main content

HashMapKindedRef

Enum HashMapKindedRef 

Source
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):

  • I64Arc<HashMapData<i64>>
  • F64Arc<HashMapData<f64>>
  • BoolArc<HashMapData<u8>>
  • CharArc<HashMapData<char>> (dead-but-derived per §C.5)
  • StringArc<HashMapData<*const StringObj>>
  • DecimalArc<HashMapData<*const DecimalObj>>
  • TypedObjectArc<HashMapData<TypedObjectPtr>>
  • TraitObjectArc<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_X constructor-shape; not a shim.
  • Re-introducing HashMapValueBuf arms 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 on HashMapData<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

Source

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):

  • I64NativeKind::Int64
  • F64NativeKind::Float64
  • BoolNativeKind::Bool
  • CharNativeKind::Char (dead-but-derived per §C.5)
  • StringNativeKind::Ptr(HeapKind::String)
  • DecimalNativeKind::Ptr(HeapKind::Decimal)
  • TypedObjectNativeKind::Ptr(HeapKind::TypedObject)
  • TraitObjectNativeKind::Ptr(HeapKind::TraitObject)
  • HashMapNativeKind::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).

Source

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).

Source

pub fn is_empty(&self) -> bool

Whether the map is empty (zero entries). Dispatches per-V via len().

Source

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).

Source

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

Source§

fn clone(&self) -> Self

Per-variant Arc::clone — single refcount bump on the inner Arc<HashMapData<V>>. No structural copy.

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HashMapKindedRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HashMapValueElem for HashMapKindedRef

Source§

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 share_clone(elem: &Self) -> Self

Clone a single element with proper refcount-share semantics. Read more
Source§

unsafe fn release_owned(_value: Self)

Release a single owned value (one refcount share). For POD V it is a no-op (byte copy falls out of scope). For HeapElement V the share is retired via release_elem on the pointer. For Ptr-newtype V the wrapper’s Drop runs automatically when the value drops. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,