Skip to main content

ValueSlot

Struct ValueSlot 

Source
pub struct ValueSlot(/* private fields */);
Expand description

A raw 8-byte value slot for TypedObject field storage.

Implementations§

Source§

impl ValueSlot

Source

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

Source

pub fn from_number(n: f64) -> Self

Store a f64 as raw IEEE 754 bits.

Source

pub fn from_int(i: i64) -> Self

Store an i64 as raw two’s complement bits. Full 64-bit range, no precision loss.

Source

pub fn from_u64(v: u64) -> Self

Store a u64 directly. Only meaningful when the FieldType is known to be U64.

Source

pub fn as_u64(&self) -> u64

Read as u64 (caller must know this slot is u64 type).

Source

pub fn from_bool(b: bool) -> Self

Store a bool as 1/0.

Source

pub fn none() -> Self

Store None as zero bits.

Source

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

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

Source

pub fn from_string_arc(s: Arc<String>) -> Self

Store an Arc<String> directly. Mirrors FieldType::String / NativeKind::String / HeapValue::String(Arc<String>).

Source

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

Source

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

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

Source

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

Source

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.

Source

pub fn from_bigint(b: Arc<i64>) -> Self

Store an Arc<i64> (BigInt payload) directly. Mirrors HeapValue::BigInt(Arc<i64>) (post Step 3).

Source

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> retire occurs at HashMapKindedRef’s Drop on refcount-0 of the outer Arc).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

Source

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

Source

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.

Source

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

Source

pub fn from_data_table(t: Arc<DataTable>) -> Self

Store an Arc<DataTable> directly. Mirrors HeapValue::DataTable(Arc<DataTable>).

Source

pub fn from_io_handle(h: Arc<IoHandleData>) -> Self

Store an Arc<IoHandleData> directly. Mirrors HeapValue::IoHandle(Arc<IoHandleData>).

Source

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

Source

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.

Source

pub fn as_char(&self) -> Option<char>

Read as char (caller must know this slot is char type).

Source

pub fn as_f64(&self) -> f64

Read as f64 (caller must know this slot is f64 type).

Source

pub fn as_i64(&self) -> i64

Read as i64 (caller must know this slot is i64 type).

Source

pub fn as_bool(&self) -> bool

Read as bool (caller must know this slot is bool type).

Source

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.

Source

pub fn raw(&self) -> u64

Raw bits for simple copy.

Source

pub fn from_raw(bits: u64) -> Self

Construct from raw bits.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for ValueSlot

Source§

fn clone(&self) -> ValueSlot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ValueSlot

Source§

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

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

impl Copy for ValueSlot

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,