#[repr(C)]pub struct KindedSlot {
pub slot: ValueSlot,
pub kind: NativeKind,
}Expand description
Caller-side runtime-value carrier: a ValueSlot paired with the
NativeKind that interprets it. ADR-006 §2.7.
Not Copy. Drop and clone dispatch on kind to manage heap
refcounts; aliasing copies would leak / double-free.
Fields§
§slot: ValueSlot§kind: NativeKindImplementations§
Source§impl KindedSlot
impl KindedSlot
Sourcepub fn new(slot: ValueSlot, kind: NativeKind) -> Self
pub fn new(slot: ValueSlot, kind: NativeKind) -> Self
Construct from an already-owned slot + its kind. The caller must
ensure the slot’s bits are a valid representation of kind (e.g.
for heap kinds, one strong-count share owned by this KindedSlot).
Sourcepub fn from_number(n: f64) -> Self
pub fn from_number(n: f64) -> Self
Convenience: a Float64-kind slot.
Sourcepub fn from_f32(f: f32) -> Self
pub fn from_f32(f: f32) -> Self
Convenience: a Float32-kind slot. ADR-006 §2.7.5 amendment
(Round 19 S1.5 W12-nativekind-scalar-additions, 2026-05-14).
f32 is a 4-byte scalar; slot bits store the IEEE-754
single-precision pattern zero-extended into the low 32 bits of
the 8-byte slot (via f32::to_bits reinterpreted as u64).
Drop is a no-op (inline scalar, no Arc<T> payload).
Sourcepub fn from_string_arc(s: Arc<String>) -> Self
pub fn from_string_arc(s: Arc<String>) -> Self
Convenience: a String-kind slot from an Arc<String>.
Sourcepub fn from_typed_object(o: Arc<TypedObjectStorage>) -> Self
pub fn from_typed_object(o: Arc<TypedObjectStorage>) -> Self
Convenience: a Ptr(HeapKind::TypedObject)-kind slot from an
Arc<TypedObjectStorage>. Wave 2 Agent D1 (2026-05-14): legacy
transitional constructor — see ValueSlot::from_typed_object
docstring for the Arc-vs-raw-pointer staging. Slot bits are
Arc::into_raw(o).
Sourcepub fn from_typed_object_raw(ptr: *const TypedObjectStorage) -> Self
pub fn from_typed_object_raw(ptr: *const TypedObjectStorage) -> Self
Convenience: a Ptr(HeapKind::TypedObject)-kind slot from a raw
*const TypedObjectStorage. Wave 2 Agent D1 (2026-05-14): v2-raw
raw-pointer constructor. Per ADR-006 §2.3 amendment + audit §4.3
O-3.a resolution. Pairs with TypedObjectStorage::_new allocator;
refcount discipline goes through the on-header refcount via
v2_retain / v2_release (NOT Rust Arc::increment/decrement_ strong_count). See ValueSlot::from_typed_object_raw docstring
for the full call-site migration pattern.
Sourcepub fn from_hashmap(h: Arc<HashMapKindedRef>) -> Self
pub fn from_hashmap(h: Arc<HashMapKindedRef>) -> Self
Convenience: a Ptr(HeapKind::HashMap)-kind slot.
Wave 2 Round 3b C2-joint ckpt-2 (2026-05-14): parameter type
flipped from Arc<HashMapData> (non-generic) to
Arc<HashMapKindedRef> (per-V enum carrier in Arc) per ADR-006
§2.7.24 Q25.B SUPERSEDED.
Sourcepub fn from_hashset(h: Arc<HashSetData>) -> Self
pub fn from_hashset(h: Arc<HashSetData>) -> Self
Convenience: a Ptr(HeapKind::HashSet)-kind slot. Mirror of
from_hashmap per ADR-006 §2.7.15 / Q16 amendment (Wave 13
W13-hashset-rebuild). Set is a HashMap sibling — full
HeapValue::HashSet(Arc<HashSetData>) arm, not pure-discriminator.
Sourcepub fn from_deque(d: Arc<DequeData>) -> Self
pub fn from_deque(d: Arc<DequeData>) -> Self
Convenience: a Ptr(HeapKind::Deque)-kind slot. Mirror of
from_hashset per ADR-006 §2.7.19 / Q20 amendment (Wave 15
W15-deque). Deque is a HashSet sibling — full
HeapValue::Deque(Arc<DequeData>) arm, not pure-discriminator.
Sourcepub fn from_channel(c: Arc<ChannelData>) -> Self
pub fn from_channel(c: Arc<ChannelData>) -> Self
Convenience: a Ptr(HeapKind::Channel)-kind slot. Mirror of
from_hashset per ADR-006 §2.7.20 / Q21 amendment (Wave 15
W15-channel-rebuild). Channel is the first concurrency
primitive to land kinded — full
HeapValue::Channel(Arc<ChannelData>) arm, not pure-discriminator.
Inner state carries Mutex<ChannelInner>; cloning the outer
Arc hands out a fresh endpoint of the same channel.
Sourcepub fn from_trait_object(t: Arc<TraitObjectStorage>) -> Self
pub fn from_trait_object(t: Arc<TraitObjectStorage>) -> Self
Convenience: a Ptr(HeapKind::TraitObject)-kind slot. Mirror
of from_typed_object per ADR-006 §2.7.24 / Q25.C amendment
(Wave 17 W17-trait-object-storage, 2026-05-11). Full
HeapValue::TraitObject(Arc<TraitObjectStorage>) arm —
TraitObjectStorage is the typed-Arc replacement for the
bulldozer-deleted HeapValue::TraitObject { value: Box<u64>, vtable: Arc<VTable> } shape.
Wave 2 Agent E (2026-05-14): legacy transitional constructor.
See ValueSlot::from_trait_object docstring for the Arc-vs-raw-pointer
staging.
Sourcepub fn from_trait_object_raw(ptr: *const TraitObjectStorage) -> Self
pub fn from_trait_object_raw(ptr: *const TraitObjectStorage) -> Self
Convenience: a Ptr(HeapKind::TraitObject)-kind slot from a raw
*const TraitObjectStorage. Wave 2 Agent E (2026-05-14): v2-raw
raw-pointer constructor. Per ADR-006 §Q25.C.5 amendment + audit
§4.3 O-3.a resolution. Pairs with TraitObjectStorage::_new
allocator; refcount discipline goes through the on-header refcount
via v2_retain / v2_release (NOT Rust Arc::increment/decrement_ strong_count). See ValueSlot::from_trait_object_raw docstring
for the full call-site migration pattern.
Sourcepub fn from_mutex(m: Arc<MutexData>) -> Self
pub fn from_mutex(m: Arc<MutexData>) -> Self
Convenience: a Ptr(HeapKind::Mutex)-kind slot. Mirror of
from_channel per ADR-006 §2.7.25 amendment (Wave 17
W17-concurrency, 2026-05-11). Full
HeapValue::Mutex(Arc<MutexData>) arm.
Sourcepub fn from_atomic(a: Arc<AtomicData>) -> Self
pub fn from_atomic(a: Arc<AtomicData>) -> Self
Convenience: a Ptr(HeapKind::Atomic)-kind slot. Mirror of
from_channel per ADR-006 §2.7.25 amendment (Wave 17
W17-concurrency, 2026-05-11). Full
HeapValue::Atomic(Arc<AtomicData>) arm. i64-only at landing.
Sourcepub fn from_lazy(l: Arc<LazyData>) -> Self
pub fn from_lazy(l: Arc<LazyData>) -> Self
Convenience: a Ptr(HeapKind::Lazy)-kind slot. Mirror of
from_channel per ADR-006 §2.7.25 amendment (Wave 17
W17-concurrency, 2026-05-11). Full
HeapValue::Lazy(Arc<LazyData>) arm.
Sourcepub fn from_temporal(arc: Arc<TemporalData>) -> Self
pub fn from_temporal(arc: Arc<TemporalData>) -> Self
Convenience: a Ptr(HeapKind::Temporal)-kind slot. ADR-006
§2.7.6 / Q8 cardinality amendment (Wave 3 W17-from-temporal-
instant-constructors, 2026-05-12). Slot bits are
Arc::into_raw(Arc<TemporalData>) as u64; recovery goes through
the canonical 5-arm receiver-recovery pattern (reconstruct via
Arc::<TemporalData>::from_raw, clone, into_raw to restore).
Mirror of from_iterator typed-Arc dispatch shape — TemporalData
is the consolidated DateTime / Duration / TimeSpan / Timeframe /
TimeReference / DateTimeExpr / DataDateTimeRef carrier per
heap_value.rs::TemporalData. The Drop / Clone arms for
HeapKind::Temporal already dispatch the matching strong-count
retain/release; this constructor pairs with them by the §2.7.6 /
Q8 bounded carrier-API rule (one constructor per NativeKind heap
variant, no new heap-variant cardinality introduced).
Sourcepub fn from_instant(arc: Arc<Instant>) -> Self
pub fn from_instant(arc: Arc<Instant>) -> Self
Convenience: a Ptr(HeapKind::Instant)-kind slot. ADR-006
§2.7.6 / Q8 cardinality amendment (Wave 3 W17-from-temporal-
instant-constructors, 2026-05-12). Slot bits are
Arc::into_raw(Arc<std::time::Instant>) as u64; recovery goes
through the canonical 5-arm receiver-recovery pattern. Mirror of
from_temporal for the Instant sibling — Instant rides
Arc<std::time::Instant> directly (no InstantData wrapper).
The Drop / Clone arms for HeapKind::Instant already dispatch
the matching strong-count retain/release; this constructor pairs
with them by the §2.7.6 / Q8 bounded carrier-API rule.
Sourcepub fn from_iterator(it: Arc<IteratorState>) -> Self
pub fn from_iterator(it: Arc<IteratorState>) -> Self
Convenience: a Ptr(HeapKind::Iterator)-kind slot. Stores the
Arc::into_raw pointer directly per ADR-006 §2.7.16 / Q17 (W13-
iterator-state).
Sourcepub fn from_priority_queue(p: Arc<PriorityQueueData>) -> Self
pub fn from_priority_queue(p: Arc<PriorityQueueData>) -> Self
Convenience: a Ptr(HeapKind::PriorityQueue)-kind slot. Mirror
of from_hashset per ADR-006 §2.7.18 / Q19 amendment (Wave 15
W15-priority-queue). PriorityQueue is a HashSet sibling — full
HeapValue::PriorityQueue(Arc<PriorityQueueData>) arm, not
pure-discriminator.
Sourcepub fn from_range(r: Arc<RangeData>) -> Self
pub fn from_range(r: Arc<RangeData>) -> Self
Convenience: a Ptr(HeapKind::Range)-kind slot. Stores the
Arc<RangeData> directly per ADR-006 §2.7.23 / Q24 (W15-range).
Slot bits are Arc::into_raw(Arc<RangeData>) as u64; recovery
goes through slot.as_heap_value() → HeapValue::Range(arc)
per ADR-005 §1 single-discriminator.
Sourcepub fn from_result(r: Arc<ResultData>) -> Self
pub fn from_result(r: Arc<ResultData>) -> Self
Convenience: a Ptr(HeapKind::Result)-kind slot. ADR-006 §2.7.17 /
Q18 amendment (Wave 14 W14-variant-codegen). Mirror of
from_iterator typed-Arc dispatch shape.
Sourcepub fn from_option(o: Arc<OptionData>) -> Self
pub fn from_option(o: Arc<OptionData>) -> Self
Convenience: a Ptr(HeapKind::Option)-kind slot. ADR-006 §2.7.17 /
Q18 amendment (Wave 14 W14-variant-codegen).
Sourcepub fn from_decimal(d: Arc<Decimal>) -> Self
pub fn from_decimal(d: Arc<Decimal>) -> Self
Convenience: a Ptr(HeapKind::Decimal)-kind slot.
Sourcepub fn from_string_v2_ptr(ptr: *const StringObj) -> Self
pub fn from_string_v2_ptr(ptr: *const StringObj) -> Self
Convenience: a StringV2-kind slot from a v2-raw *const StringObj
pointer. ADR-006 §2.7.5 amendment (Wave 2 Agent B W12-StringV2-
DecimalV2-NativeKind-additions, 2026-05-14): paired with
NativeKind::StringV2 per the audit §H.4 H-c decision. Slot bits
= ptr as u64; the KindedSlot owns one refcount share on the
underlying StringObj — Drop dispatches the matching v2_release
against the HeapHeader at offset 0.
Caller’s construction-side contract: ptr MUST point to a live
StringObj whose refcount has been incremented (typically via
v2_retain at the producing op_typed_array_get site) to claim
the share this KindedSlot now owns. Mirror of from_string_arc’s
“slot owns one strong share” contract — but the underlying retain
is v2_retain against the repr(C) HeapHeader, not
Arc::increment_strong_count against an Arc<String>.
Sourcepub fn from_decimal_v2_ptr(ptr: *const DecimalObj) -> Self
pub fn from_decimal_v2_ptr(ptr: *const DecimalObj) -> Self
Convenience: a DecimalV2-kind slot from a v2-raw *const DecimalObj
pointer. ADR-006 §2.7.5 amendment (Wave 2 Agent B W12-StringV2-
DecimalV2-NativeKind-additions, 2026-05-14): mirror of
from_string_v2_ptr for the DecimalObj sibling. Same construction-
side contract.
Sourcepub fn from_bigint(b: Arc<i64>) -> Self
pub fn from_bigint(b: Arc<i64>) -> Self
Convenience: a Ptr(HeapKind::BigInt)-kind slot.
Sourcepub fn from_char(c: char) -> Self
pub fn from_char(c: char) -> Self
Convenience: a Char-kind slot. ADR-006 §2.7.5 amendment (Round
19 S1.5 W12-nativekind-scalar-additions, 2026-05-14): Char joins
the scalar bucket — char is Copy + 4-byte (UTF-32 codepoint),
no Arc payload. Slot bits store c as u32 zero-extended into
the low 32 bits of the 8-byte slot.
Pre-amendment (Round 18 and earlier) this constructor returned
a slot with kind NativeKind::Ptr(HeapKind::Char) — the inline-
codepoint payload tagged through HeapKind for dispatch
uniformity. The post-amendment shape is a pure scalar variant
(NativeKind::Char), aligning Char with the other 4-byte
scalars (Int32 / UInt32 / Float32) per §Q8 carrier-API
bound (one constructor per scalar variant). The
NativeKind::Ptr(HeapKind::Char) label still exists in source
(direct push_kinded(c as u64, NativeKind::Ptr(HeapKind::Char))
call-sites have NOT been migrated in this dispatch — a future
cluster-1 hardening sub-cluster retires that parallel label).
Drop is a no-op (inline scalar; the NativeKind::Char arm in
Drop is part of the inline-scalar group).
Sourcepub fn from_matrix(m: Arc<MatrixData>) -> Self
pub fn from_matrix(m: Arc<MatrixData>) -> Self
Convenience: a Ptr(HeapKind::Matrix)-kind slot. ADR-006 §2.7.22
amendment (Round 18 S3 W12-matrix-floatslice-heapkind-exit,
2026-05-13). Slot bits are Arc::into_raw(Arc<MatrixData>) as u64;
recovery goes through the canonical reconstruct-clone-restore
pattern (Arc::<MatrixData>::from_raw(bits) → clone → into_raw)
to bump the inner share while preserving the carrier’s owned
outer share. Mirror of from_iterator / from_range typed-Arc
dispatch shape — as_heap_value() on a Matrix-labeled slot is
unsound (the slot bits are an Arc<MatrixData> pointer, not a
*const HeapValue). The Drop / Clone arms for HeapKind::Matrix
dispatch the matching Arc::increment/decrement_strong_count ::<MatrixData> retain/release.
Sourcepub fn from_matrix_slice(s: Arc<MatrixSliceData>) -> Self
pub fn from_matrix_slice(s: Arc<MatrixSliceData>) -> Self
Convenience: a Ptr(HeapKind::MatrixSlice)-kind slot. ADR-006
§2.7.22 amendment (Round 18 S3 W12-matrix-floatslice-heapkind-exit,
2026-05-13). Slot bits are
Arc::into_raw(Arc<MatrixSliceData>) as u64. Same typed-Arc
pure-discriminator dispatch shape as from_matrix. The inner
MatrixSliceData { parent, offset, len } retains a separate
strong-count share on its parent matrix; cloning the outer share
does NOT bump the parent — that bump happens at
MatrixSliceData::clone (auto-derived) when the inner struct is
duplicated under Arc::make_mut.
Sourcepub fn from_module_fn_id(id: u64) -> Self
pub fn from_module_fn_id(id: u64) -> Self
Convenience: a Ptr(HeapKind::ModuleFn)-kind slot. Stores the
module_fn_id as raw u64 slot bits directly (inline-scalar
payload — no Arc<T>, no heap state). Same shape as
from_char / from_future per ADR-006 §2.7.26
(W17-comptime-vm-dispatch).
Construction-side contract: id must index a registered entry
in VirtualMachine.module_fn_table. The dispatch shell at
executor/call_convention.rs::call_value_immediate_nb consumes
the kind label to route the slot’s bits to
invoke_module_fn_id_stub at CallValue time.
Sourcepub fn from_string(s: &str) -> Self
pub fn from_string(s: &str) -> Self
Convenience: a String-kind slot from a &str. Allocates a fresh
Arc<String>. Use from_string_arc when you already have the
Arc<String> in hand and want to avoid a clone.
Sourcepub fn none() -> Self
pub fn none() -> Self
A null/none-value KindedSlot. Bool-kind by convention so the slot
has a stable interpretation and Drop is a no-op.
Sourcepub fn kind(&self) -> NativeKind
pub fn kind(&self) -> NativeKind
Read the kind.
Sourcepub fn raw(&self) -> u64
pub fn raw(&self) -> u64
Raw slot bits. Provided for sites that need to peek at the storage shape (e.g. wire serialization). Prefer typed accessors.
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Read as f64 if self.kind == NativeKind::Float64, else None.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Read as bool if self.kind == NativeKind::Bool, else None.
Sourcepub fn as_char(&self) -> Option<char>
pub fn as_char(&self) -> Option<char>
Read as char if self.kind == NativeKind::Char, else None.
ADR-006 §2.7.5 amendment (Round 19 S1.5, 2026-05-14): the §Q8
carrier-API bound binds as_char to the new scalar
NativeKind::Char variant. The pre-amendment
NativeKind::Ptr(HeapKind::Char) carrier label is ALSO recognized
for cross-tier-compatibility — the label still exists in source
(direct push_kinded(c as u64, NativeKind::Ptr(HeapKind::Char))
call-sites have NOT been migrated in this dispatch); recognizing
both labels avoids producer/consumer mismatch when those call-
sites flow values through code paths that materialize as
KindedSlot before consuming as_char. Both labels store
codepoint bits zero-extended in the low 32 bits of the slot, so
the read is identical in either kind.
Trait Implementations§
Source§impl Clone for KindedSlot
Clone dispatches on kind to bump the matching Arc<T> strong-count.
impl Clone for KindedSlot
Clone dispatches on kind to bump the matching Arc<T> strong-count.
Source§impl Debug for KindedSlot
impl Debug for KindedSlot
Source§impl Default for KindedSlot
impl Default for KindedSlot
Source§impl Drop for KindedSlot
Drop dispatches on kind to retire the matching Arc<T> strong-count
share. Mirrors TypedObjectStorage::Drop in heap_value.rs:761.
impl Drop for KindedSlot
Drop dispatches on kind to retire the matching Arc<T> strong-count
share. Mirrors TypedObjectStorage::Drop in heap_value.rs:761.