Skip to main content

FromSlot

Trait FromSlot 

Source
pub trait FromSlot: Sized {
    const NATIVE_KIND: NativeKind;

    // Required method
    fn from_slot(bits: u64) -> Self;
}
Expand description

Read a typed value from an 8-byte raw-bits slot.

The associated constant Self::NATIVE_KIND declares which kind the slot must have. The marshal-layer dispatcher guarantees the contract by reading arg_kinds() at registration and only invoking the body with matching slot bits — from_slot impls therefore do not invoke the deleted tag_bits dispatch.

Required Associated Constants§

Required Methods§

Source

fn from_slot(bits: u64) -> Self

SAFETY contract (enforced by the marshal-layer wrapper, not by this trait method): bits must have been produced by a slot that was statically proven to have kind NATIVE_KIND.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromSlot for Option<f64>

Source§

const NATIVE_KIND: NativeKind = NativeKind::NullableFloat64

Source§

fn from_slot(bits: u64) -> Self

Source§

impl FromSlot for bool

Source§

const NATIVE_KIND: NativeKind = NativeKind::Bool

Source§

fn from_slot(bits: u64) -> Self

Source§

impl FromSlot for f64

Source§

const NATIVE_KIND: NativeKind = NativeKind::Float64

Source§

fn from_slot(bits: u64) -> Self

Source§

impl FromSlot for i64

Source§

const NATIVE_KIND: NativeKind = NativeKind::Int64

Source§

fn from_slot(bits: u64) -> Self

Source§

impl FromSlot for Arc<String>

Read an Arc<String> from a heap-pointer slot.

The slot owns one strong reference; cloning it for the body’s use requires incrementing the refcount. The marshal wrapper does not take ownership of the slot — it stays valid for the duration of the call. The body receives an independent strong reference.

Source§

const NATIVE_KIND: NativeKind = NativeKind::String

Source§

fn from_slot(bits: u64) -> Self

Source§

impl FromSlot for Arc<Vec<f64>>

Read an Arc<Vec<f64>> from a NativeKind::Ptr(HeapKind::TypedArray) slot whose payload is *mut TypedArray<f64>. V3-S5 ckpt-5-prime²c Migration shape (a) — replaces the pre-migration FromSlot for Arc<AlignedTypedBuffer> entry.

Source§

impl FromSlot for Arc<Vec<i64>>

Read an Arc<Vec<i64>> from a NativeKind::Ptr(HeapKind::TypedArray) slot whose payload is *mut TypedArray<i64>. V3-S5 ckpt-5-prime²c Migration shape (a) — replaces the pre-migration FromSlot for Arc<TypedBuffer<i64>> entry.

Source§

impl FromSlot for Arc<Vec<u8>>

Read an Arc<Vec<u8>> from a NativeKind::Ptr(HeapKind::TypedArray) slot whose payload is *mut TypedArray<u8>. V3-S5 ckpt-5-prime²c Migration shape (a) — replaces the pre-migration FromSlot for Arc<TypedBuffer<u8>> entry.

Note: the pre-migration Bool-vs-U8 Rust-type-collision residual carries forward — Array<bool> lowers to *mut TypedArray<u8> per the v2 carrier shape (bool is stored as u8 with the dispatch-level Bool stamp at stamp_elem_type). A body declaring Arc<Vec<u8>> and being handed an Array<bool> slot will read raw bytes correctly but cannot distinguish “Array” from “Array” at this boundary. Resolution when a Bool consumer surfaces.

Source§

impl FromSlot for Arc<DataTable>
where Self: Sized,

Read the inner Arc<DataTable> from a NativeKind::Ptr(HeapKind::DataTable) slot.

Source§

impl FromSlot for Arc<IoHandleData>
where Self: Sized,

Read the inner Arc<IoHandleData> from a NativeKind::Ptr(HeapKind::IoHandle) slot.

Source§

impl FromSlot for Vec<(Arc<String>, Arc<HeapValue>)>

Read a Vec<(Arc<String>, Arc<HeapValue>)> from a NativeKind::Ptr(HeapKind::HashMap) slot.

Body-type pattern: bodies declaring args: Vec<(Arc<String>, Arc<HeapValue>)> receive an owned pair-list with insertion order preserved and polymorphic-typed values. Each element is an opaque Arc<HeapValue>; the body is responsible for pattern-matching the inner kind per the option ε contract. No element-kind constraint at the marshal boundary.

Source§

impl FromSlot for Vec<(Arc<String>, Arc<String>)>

Read a Vec<(Arc<String>, Arc<String>)> from a NativeKind::Ptr(HeapKind::HashMap) slot.

Body-type pattern: bodies declaring args: Vec<(Arc<String>, Arc<String>)> receive an owned pair-list with insertion order preserved. Each value is expected to be HeapValue::String(_); mismatch panics as the spec-permitted consistency check (docs/runtime-v2-spec.md).

Source§

impl FromSlot for Vec<i64>

Read a Vec<i64> from a NativeKind::Ptr(HeapKind::TypedArray) slot whose payload is *mut TypedArray<i64>. V3-S5 ckpt-5-prime²c (2026-05-15): rewritten for the v2-raw flat-struct carrier. Owns-clone semantics.

Source§

impl FromSlot for Vec<u8>

Read a Vec<u8> from a NativeKind::Ptr(HeapKind::TypedArray) slot whose payload is *mut TypedArray<u8>.

V3-S5 ckpt-5-prime²c (2026-05-15): rewritten for the v2-raw flat-struct carrier. Slot bits are a raw *mut TypedArray<u8> pointer; element-data is copied into a fresh Vec<u8> (owns-clone semantics — body receives an owned vector independent of the slot’s refcount share).

Source§

impl FromSlot for Vec<Arc<HeapValue>>

Read a Vec<Arc<HeapValue>> from a NativeKind::Ptr(HeapKind::TypedArray) slot.

V3-S5 ckpt-5-prime²c (2026-05-15) SURFACE-AND-STOP: the materialize_heap_arcs helper (deleted alongside this comment block) re-wrapped each strict-typed element into a HeapValue::* Arc by pattern-matching the deleted TypedArrayData enum. The new *mut TypedArray<T> flat-struct carrier needs a per-T dispatcher (one impl per element width: *const StringObj, *const DecimalObj, TypedObjectPtr, char, etc.) plus a parallel element-kind discriminator in the marshal layer to know which T the slot was constructed for. The element discriminator already exists at the VM level (stamp_elem_type at crates/shape-vm/src/executor/v2_handlers/array.rs) but isn’t yet exposed at the marshal-FromSlot boundary.

Adding this dispatcher is the Round 2 Vec<Arc<HeapValue>> rewire follow-up; pairs with the from_typed_array_<T> constructor wave at crates/shape-value/src/slot.rs:142 and the matching ckpt-6 JIT FFI String/Decimal build work. Until that lands, the marshal-FromSlot panics with a structured error pointing at the follow-up — any stdlib body declaring Vec<Arc<HeapValue>> and reaching this from_slot is currently dead at the marshal boundary (consistent with V3-S5 ckpt-5’s wholesale HeapValue::TypedArray outer-arm deletion).

Source§

impl FromSlot for Vec<Arc<String>>

Read a Vec<Arc<String>> from a NativeKind::Ptr(HeapKind::TypedArray) slot whose payload is *mut TypedArray<*const StringObj>. V3-S5 ckpt-5-prime²c (2026-05-15): rewritten for the v2-raw flat-struct carrier (each element is a raw *const StringObj — the per-element allocator-managed v2 string carrier per crates/shape-value/src/v2/ string_obj.rs). Each element string is copied into a fresh Arc<String> (owns-clone semantics — body receives an owned vector of independent Arcs).

Implementors§