pub struct ValueSlot(/* private fields */);Expand description
A raw 8-byte value slot for TypedObject field storage.
Implementations§
Source§impl ValueSlot
impl ValueSlot
Sourcepub fn from_typed_scalar(ts: TypedScalar) -> (Self, bool)
pub fn from_typed_scalar(ts: TypedScalar) -> (Self, bool)
Create a ValueSlot from a TypedScalar.
Returns (slot, is_heap) — is_heap is always false for scalars
since all scalar values fit in 8 bytes without heap allocation.
Source§impl ValueSlot
impl ValueSlot
Sourcepub fn from_number(n: f64) -> Self
pub fn from_number(n: f64) -> Self
Store a f64 as raw IEEE 754 bits.
Sourcepub fn from_int(i: i64) -> Self
pub fn from_int(i: i64) -> Self
Store an i64 as raw two’s complement bits. Full 64-bit range, no precision loss.
Sourcepub fn from_u64(v: u64) -> Self
pub fn from_u64(v: u64) -> Self
Store a u64 directly. Only meaningful when the FieldType is known to be U64.
Sourcepub fn from_heap(value: HeapValue) -> Self
👎Deprecated: Box<HeapValue> wrapping. Use a per-FieldType constructor (from_string_arc, from_typed_object, from_decimal, from_bigint, from_hashmap, …). Array fields: V3-S5 ckpt-4 deleted from_typed_array along with the TypedArrayData enum; per-element-kind from_typed_array_<T>(Arc<TypedArray<T>>) constructors are the v2-raw replacement (downstream wave rebuild). See ADR-006 §2.4 + W12 audit §3.5/§B.
pub fn from_heap(value: HeapValue) -> Self
Box<HeapValue> wrapping. Use a per-FieldType constructor (from_string_arc, from_typed_object, from_decimal, from_bigint, from_hashmap, …). Array fields: V3-S5 ckpt-4 deleted from_typed_array along with the TypedArrayData enum; per-element-kind from_typed_array_<T>(Arc<TypedArray<T>>) constructors are the v2-raw replacement (downstream wave rebuild). See ADR-006 §2.4 + W12 audit §3.5/§B.
Store any HeapValue on the heap. The caller MUST set the corresponding
bit in heap_mask so Drop knows to free this.
Without gc feature: allocates via Box (freed by drop_heap).
With gc feature: allocates via GcHeap (freed by garbage collector).
Sourcepub fn from_string_arc(s: Arc<String>) -> Self
pub fn from_string_arc(s: Arc<String>) -> Self
Store an Arc<String> directly. Mirrors FieldType::String /
NativeKind::String / HeapValue::String(Arc<String>).
Sourcepub fn from_typed_object(o: Arc<TypedObjectStorage>) -> Self
pub fn from_typed_object(o: Arc<TypedObjectStorage>) -> Self
Store an Arc<TypedObjectStorage> directly. Mirrors
FieldType::Object(_) / NativeKind::Ptr(HeapKind::TypedObject) /
HeapValue::TypedObject(Arc<TypedObjectStorage>) (post Step 4 /
ADR-006 §2.3).
Wave 2 Agent D1 (2026-05-14): legacy transitional constructor.
Per ADR-006 §2.3 amendment, TypedObjectStorage grew a HeapHeader
at offset 0 to support v2-raw raw-pointer carriers
(from_typed_object_raw). This Arc-shaped constructor remains the
canonical Wave-2-pre-D2 entry point; the 18 production construction
sites migrate to from_typed_object_raw in D2 (Round 2). After D2’s
close, the last caller is gone and this constructor is deleted
alongside the legacy impl Drop for TypedObjectStorage path. Slot
bits stored are Arc::into_raw(arc) as u64 — refcount-managed by
Rust Arc at offset -16, NOT by the on-header refcount at offset 0
(which sits unused at 1 for the Arc lifetime).
Sourcepub fn from_typed_object_raw(ptr: *const TypedObjectStorage) -> Self
pub fn from_typed_object_raw(ptr: *const TypedObjectStorage) -> Self
Store a raw *const TypedObjectStorage directly. Mirrors
FieldType::Object(_) / NativeKind::Ptr(HeapKind::TypedObject).
Wave 2 Agent D1 (2026-05-14): v2-raw raw-pointer constructor.
Per ADR-006 §2.3 amendment + audit §4.3 Obstacle O-3.a resolution,
TypedObjectStorage carries a HeapHeader at offset 0; the v2-raw
allocator TypedObjectStorage::_new returns *mut TypedObjectStorage
with refcount=1 on the header. The slot bits stored are the raw
pointer (NOT Arc::into_raw); refcount discipline goes through
v2_retain / v2_release via the HeapElement trait. Drop runs
at refcount=0 via TypedObjectStorage::_drop (NOT Rust Arc::drop).
Callers (Wave 2 Agent D2, Round 2): replace the legacy pattern
let arc = Arc::new(TypedObjectStorage::new(schema_id, slots, mask, kinds));
let slot = ValueSlot::from_typed_object(arc);with the v2-raw pattern
let ptr = TypedObjectStorage::_new(schema_id, slots, mask, kinds);
let slot = ValueSlot::from_typed_object_raw(ptr);Sourcepub fn from_decimal(d: Arc<Decimal>) -> Self
pub fn from_decimal(d: Arc<Decimal>) -> Self
Store an Arc<rust_decimal::Decimal> directly. Mirrors
FieldType::Decimal / HeapValue::Decimal(Arc<Decimal>) (post Step 3).
Sourcepub fn from_string_v2_ptr(ptr: *const StringObj) -> Self
pub fn from_string_v2_ptr(ptr: *const StringObj) -> Self
Store a v2-raw *const StringObj carrier pointer directly. 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; refcount discipline
goes through v2_retain / v2_release against the HeapHeader at
offset 0 of the StringObj (NOT Arc::increment_strong_count —
StringObj is a manually-allocated repr(C) 24-byte carrier per
v2/string_obj.rs, not an Arc<String> allocation).
Caller’s construction-side contract: ptr MUST point to a live
StringObj whose refcount has been incremented to claim the share
this slot now owns (e.g. via v2_retain at the producer site).
Sourcepub fn from_decimal_v2_ptr(ptr: *const DecimalObj) -> Self
pub fn from_decimal_v2_ptr(ptr: *const DecimalObj) -> Self
Store a v2-raw *const DecimalObj carrier pointer directly. 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 per v2/decimal_obj.rs. Slot bits = ptr as u64;
refcount via v2_retain / v2_release against the HeapHeader at
offset 0 of the DecimalObj.
Sourcepub fn from_bigint(b: Arc<i64>) -> Self
pub fn from_bigint(b: Arc<i64>) -> Self
Store an Arc<i64> (BigInt payload) directly. Mirrors
HeapValue::BigInt(Arc<i64>) (post Step 3).
Sourcepub fn from_hashmap(h: Arc<HashMapKindedRef>) -> Self
pub fn from_hashmap(h: Arc<HashMapKindedRef>) -> Self
Store an Arc<HashMapKindedRef> directly. Mirrors
HeapValue::HashMap(HashMapKindedRef).
Wave 2 Round 3b C2-joint ckpt-2 (2026-05-14): signature flipped
from Arc<HashMapData> (non-generic) to Arc<HashMapKindedRef>
(per-V enum carrier wrapped in Arc) per ADR-006 §2.7.24 Q25.B
SUPERSEDED. Single Arc indirection — the inner enum’s variant tag
carries the per-V discriminator at the carrier layer, and the
4-table-lockstep arms in kinded_slot.rs + stack.rs retain/release
the outer Arc<HashMapKindedRef> (single-discriminator preserved
per ADR-005 §1; per-V Arc<HashMapData
Sourcepub fn from_hashset(h: Arc<HashSetData>) -> Self
pub fn from_hashset(h: Arc<HashSetData>) -> Self
Store an Arc<HashSetData> directly. Mirrors
HeapValue::HashSet(Arc<HashSetData>). ADR-006 §2.7.15 / Q16
amendment (Wave 13 W13-hashset-rebuild) — Set is a HashMap
sibling, full-HeapValue arm shape.
Sourcepub fn from_deque(d: Arc<DequeData>) -> Self
pub fn from_deque(d: Arc<DequeData>) -> Self
Store an Arc<DequeData> directly. Mirrors
HeapValue::Deque(Arc<DequeData>). ADR-006 §2.7.19 / Q20
amendment (Wave 15 W15-deque) — Deque is a HashSet sibling,
full-HeapValue arm shape.
Sourcepub fn from_channel(c: Arc<ChannelData>) -> Self
pub fn from_channel(c: Arc<ChannelData>) -> Self
Store an Arc<ChannelData> directly. Mirrors
HeapValue::Channel(Arc<ChannelData>). ADR-006 §2.7.20 / Q21
amendment (Wave 15 W15-channel-rebuild). Channel is a
concurrency primitive; the inner ChannelData carries
Mutex<ChannelInner> so two Arc<ChannelData> shares of the
same channel observe each other’s send / recv.
Sourcepub fn from_mutex(m: Arc<MutexData>) -> Self
pub fn from_mutex(m: Arc<MutexData>) -> Self
Store an Arc<MutexData> directly. Mirrors
HeapValue::Mutex(Arc<MutexData>). ADR-006 §2.7.25 amendment
(Wave 17 W17-concurrency, 2026-05-11). Same typed-Arc shape as
Channel; MutexData carries Mutex<MutexInner> for
interior-mutability sharing.
Sourcepub fn from_atomic(a: Arc<AtomicData>) -> Self
pub fn from_atomic(a: Arc<AtomicData>) -> Self
Store an Arc<AtomicData> directly. Mirrors
HeapValue::Atomic(Arc<AtomicData>). ADR-006 §2.7.25 amendment
(Wave 17 W17-concurrency, 2026-05-11). i64-only at landing.
Sourcepub fn from_lazy(l: Arc<LazyData>) -> Self
pub fn from_lazy(l: Arc<LazyData>) -> Self
Store an Arc<LazyData> directly. Mirrors
HeapValue::Lazy(Arc<LazyData>). ADR-006 §2.7.25 amendment
(Wave 17 W17-concurrency, 2026-05-11). Closure-call path
unlocked by W17-make-closure (aa47364).
Sourcepub fn from_priority_queue(p: Arc<PriorityQueueData>) -> Self
pub fn from_priority_queue(p: Arc<PriorityQueueData>) -> Self
Store an Arc<PriorityQueueData> directly. Mirrors
HeapValue::PriorityQueue(Arc<PriorityQueueData>). ADR-006
§2.7.18 / Q19 amendment (Wave 15 W15-priority-queue) —
PriorityQueue is a HashSet sibling, full-HeapValue arm shape.
Sourcepub fn from_range(r: Arc<RangeData>) -> Self
pub fn from_range(r: Arc<RangeData>) -> Self
Store an Arc<RangeData> directly. Mirrors
HeapValue::Range(Arc<RangeData>). ADR-006 §2.7.23 / Q24
amendment (W15-range, 2026-05-10).
Sourcepub fn from_content(c: Arc<ContentNode>) -> Self
pub fn from_content(c: Arc<ContentNode>) -> Self
Store an Arc<ContentNode> directly. Mirrors
HeapValue::Content(Arc<ContentNode>). ADR-006 §2.3 (W18.6 R8 W3
2026-05-24 — supervisor D3+D4): paired with KindedSlot::from_content
to land the Content.text(...) / Content.code(...) etc.
user-facing constructor surface and the Display.display() -> content
return-type discipline.
Sourcepub fn from_result(r: Arc<ResultData>) -> Self
pub fn from_result(r: Arc<ResultData>) -> Self
Store an Arc<ResultData> directly. Mirrors
HeapValue::Result(Arc<ResultData>). ADR-006 §2.7.17 / Q18
amendment (Wave 14 W14-variant-codegen).
Sourcepub fn from_trait_object(t: Arc<TraitObjectStorage>) -> Self
pub fn from_trait_object(t: Arc<TraitObjectStorage>) -> Self
Store an Arc<TraitObjectStorage> directly. Mirrors
HeapValue::TraitObject(Arc<TraitObjectStorage>). ADR-006
§2.7.24 / Q25.C amendment (Wave 17 W17-trait-object-storage,
2026-05-11). Re-introduces the bulldozer-deleted trait-object
carrier under the typed-Arc shape — TraitObjectStorage holds
an Arc<TypedObjectStorage> data half + an Arc<VTable>
vtable half. The Box<u64> data-half is explicitly forbidden
per §Q25.E #3 (kind-blind raw-bits storage).
Wave 2 Agent E (2026-05-14): legacy transitional constructor.
Per ADR-006 §Q25.C.5 amendment, TraitObjectStorage grew a
HeapHeader at offset 0 to support v2-raw raw-pointer carriers
(from_trait_object_raw). This Arc-shaped constructor remains
a valid entry point during the Wave 2 Round 2 transition; slot
bits stored are Arc::into_raw(arc) as u64 — refcount-managed
by Rust Arc at offset -16, NOT by the on-header refcount at
offset 0 (which sits unused at 1 for the Arc lifetime).
Sourcepub fn from_trait_object_raw(ptr: *const TraitObjectStorage) -> Self
pub fn from_trait_object_raw(ptr: *const TraitObjectStorage) -> Self
Store a raw *const TraitObjectStorage directly. Mirrors
NativeKind::Ptr(HeapKind::TraitObject).
Wave 2 Agent E (2026-05-14): v2-raw raw-pointer constructor.
Per ADR-006 §Q25.C.5 amendment + audit §4.3 Obstacle O-3.a
resolution, TraitObjectStorage carries a HeapHeader at offset 0;
the v2-raw allocator TraitObjectStorage::_new returns
*mut TraitObjectStorage with refcount=1 on the header. The slot
bits stored are the raw pointer (NOT Arc::into_raw); refcount
discipline goes through v2_retain / v2_release via the
HeapElement trait. Drop runs at refcount=0 via
TraitObjectStorage::_drop (NOT Rust Arc::drop).
The inner value: Arc<TypedObjectStorage> field stays Arc-typed
in E’s Round 2 scope per dispatch contract; D2’s lockstep flip
handles the inner shift to *mut TypedObjectStorage once the
TypedObjectStorage Arc-path retires.
Sourcepub fn from_option(o: Arc<OptionData>) -> Self
pub fn from_option(o: Arc<OptionData>) -> Self
Store an Arc<OptionData> directly. Mirrors
HeapValue::Option(Arc<OptionData>). ADR-006 §2.7.17 / Q18
amendment (Wave 14 W14-variant-codegen).
Sourcepub fn from_data_table(t: Arc<DataTable>) -> Self
pub fn from_data_table(t: Arc<DataTable>) -> Self
Store an Arc<DataTable> directly. Mirrors
HeapValue::DataTable(Arc<DataTable>).
Sourcepub fn from_io_handle(h: Arc<IoHandleData>) -> Self
pub fn from_io_handle(h: Arc<IoHandleData>) -> Self
Store an Arc<IoHandleData> directly. Mirrors
HeapValue::IoHandle(Arc<IoHandleData>).
Sourcepub fn from_native_view(v: Arc<NativeViewData>) -> Self
pub fn from_native_view(v: Arc<NativeViewData>) -> Self
Store an Arc<NativeViewData> directly. Mirrors
HeapValue::NativeView(Arc<NativeViewData>) (post Step 3, where
NativeView migrates from Box<NativeViewData> to Arc).
Sourcepub fn from_char(c: char) -> Self
pub fn from_char(c: char) -> Self
Store a primitive char codepoint. Mirrors HeapValue::Char(char)
— kept inline (not heap) but exposed under the per-FieldType naming
scheme so call sites converge on a single constructor pattern.
Sourcepub fn as_heap_value(&self) -> &HeapValue
pub fn as_heap_value(&self) -> &HeapValue
Read as heap HeapValue reference (caller must know this slot is a heap pointer). Returns a reference to the pointed-to HeapValue.
Sourcepub unsafe fn drop_heap(&mut self)
pub unsafe fn drop_heap(&mut self)
Drop the heap value. MUST only be called on heap slots.
Without gc feature: frees via Box deallocation.
With gc feature: no-op (GC handles deallocation).
§Safety
Caller must ensure this slot actually contains a valid heap pointer.
Sourcepub unsafe fn clone_heap(&self) -> Self
pub unsafe fn clone_heap(&self) -> Self
Clone a heap slot by cloning the pointed-to HeapValue into a new Box.
Without gc feature: deep clones into a new Box allocation.
With gc feature: bitwise copy (GC tracks all references).
§Safety
Caller must ensure this slot actually contains a valid heap pointer.