pub unsafe trait HashMapValueElem {
// Required methods
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
where Self: Sized;
unsafe fn share_clone(elem: &Self) -> Self
where Self: Sized;
unsafe fn release_owned(value: Self)
where Self: Sized;
}Expand description
Per-V dispatcher trait for HashMapData<V>::Drop — releases the value
buffer (*mut TypedArray<V>) at refcount-0 of the enclosing
Arc<HashMapData<V>>.
Authority: ADR-006 §2.7.24 Q25.B SUPERSEDED + bulldozer-wave-1-inventory.md
§C.4 option (a.2). The trait dispatches per-V release at compile time via
the Rust type system — no runtime NativeKind probe, no is_heap() probe,
no Bool-default fallback. Mirror of v2::heap_element::HeapElement shape,
but operates on the OUTER TypedArray<V> allocation rather than on
individual heap-element pointers.
Impls partition V into:
- POD scalar Vs (
i64,f64,u8for Bool):TypedArray::<V>::drop_arrayfrees the data buffer + the struct; no per-element work. - HeapHeader-equipped raw pointers (
*const StringObj,*const DecimalObj):TypedArray::<*const T>::drop_array_heapwalks the data buffer and callsT::release_elemper element, then frees the struct. RequiresT: v2::heap_element::HeapElement. #[repr(transparent)]newtype-as-element shapes (TypedObjectPtr,TraitObjectPtr): manual walk thatptr::reads each element to invoke itsDrop(which retires the v2-raw refcount share viarelease_elemon the inner*const TypedObjectStorage/*const TraitObjectStorage).
Char (char codepoint) is reachable per §C.5 dead-but-derived disposition
— included as a POD-scalar V.
§Safety
Implementors must guarantee:
release_typed_array(ptr)is sound whenptrpoints to a liveTypedArray<Self>allocation produced byTypedArray::<Self>::new/with_capacity/from_slice.- After this call,
ptris invalid; the data buffer + struct are freed. - Per-element ownership semantics match the storage contract — POD elements need no per-element release; HeapHeader-equipped elements have their shares retired before the data buffer is freed.
Required Methods§
Sourceunsafe fn release_typed_array(ptr: *mut TypedArray<Self>)where
Self: Sized,
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)where
Self: Sized,
Release a *mut TypedArray<Self> allocation: retire per-element
shares (where applicable) + free the data buffer + free the struct.
§Safety
ptr must point to a valid, live TypedArray<Self> allocated by
the v2-raw TypedArray::<Self> allocator (new, with_capacity,
from_slice). After this call returns, ptr is invalid.
Clone a single element with proper refcount-share semantics.
- POD scalar Vs (
i64/f64/u8/char): byte copy — no refcount work. - HeapHeader-equipped raw pointers (
*const StringObj/*const DecimalObj): pointer copy +v2_retainon the pointed-to HeapHeader. #[repr(transparent)]ptr-newtypes (TypedObjectPtr/TraitObjectPtr): delegate to the wrapper’sCloneimpl (which does v2_retain).
Wave 2 Round 3b C2-joint ckpt-3 (2026-05-14): added to support the
per-V mutation API (insert / merge / get_share) on HashMapData<V>.
Per ADR-006 §2.7.24 Q25.B SUPERSEDED + audit §C.4.
§Safety
elem must reference a live element of a TypedArray<Self> (or a
freshly-allocated element owned by the caller). The implementor
must produce a new owned share — for HeapElement / ptr-newtype V
this bumps the refcount on the pointed-to allocation; for POD V
it is a trivial copy.
Sourceunsafe fn release_owned(value: Self)where
Self: Sized,
unsafe fn release_owned(value: Self)where
Self: Sized,
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.
Wave 2 Round 3b C2-joint ckpt-3 (2026-05-14): added for the per-V mutation API’s overwrite path (insert when key already present — the old value’s share must be retired before the slot is overwritten).
§Safety
value must be a valid owned V — for HeapElement / ptr-newtype V
types the caller transfers one refcount share to this method, which
retires it.
Implementations on Foreign Types§
Source§impl HashMapValueElem for char
impl HashMapValueElem for char
Source§unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
Char codepoint (4 bytes / element). Dead-but-derived per §C.5;
included for forward-cleanliness with the HeapValue::Char
xml/json marshal path.
unsafe fn release_owned(_value: Self)
Source§impl HashMapValueElem for f64
impl HashMapValueElem for f64
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_owned(_value: Self)
Source§impl HashMapValueElem for i64
impl HashMapValueElem for i64
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_owned(_value: Self)
Source§impl HashMapValueElem for *const DecimalObj
impl HashMapValueElem for *const DecimalObj
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_owned(value: Self)
Source§impl HashMapValueElem for *const StringObj
impl HashMapValueElem for *const StringObj
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_owned(value: Self)
Source§impl HashMapValueElem for u8
impl HashMapValueElem for u8
Source§unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
unsafe fn release_typed_array(ptr: *mut TypedArray<Self>)
Used as the Bool V (one byte per element).