Skip to main content

StorageHint

Type Alias StorageHint 

Source
pub type StorageHint = NativeKind;
Expand description

Backwards-compatible alias. Prefer NativeKind in new code.

Aliased Type§

pub enum StorageHint {
Show 30 variants Float64, NullableFloat64, Float32, Char, Int8, NullableInt8, UInt8, NullableUInt8, Int16, NullableInt16, UInt16, NullableUInt16, Int32, NullableInt32, UInt32, NullableUInt32, Int64, NullableInt64, UInt64, NullableUInt64, IntSize, NullableIntSize, UIntSize, NullableUIntSize, Bool, Null, String, StringV2, DecimalV2, Ptr(HeapKind),
}

Variants§

§

Float64

Plain f64 value (direct float operations)

§

NullableFloat64

Nullable f64 using NaN sentinel (Option) IEEE 754: NaN + x = NaN, so null propagates automatically

§

Float32

Plain f32 value (4-byte single-precision float). ADR-006 §2.7.5 amendment (Round 19 S1.5 W12-nativekind-scalar-additions, 2026-05-14): non-parametric scalar variant introduced for Array<f32> v2-raw producer paths. f32 is Copy + 4-byte and fits the v2-raw TypedArray<T> flat-struct shape without Arc wrapping. Slot bits store the f32 zero-extended into the low 32 bits of the 8-byte slot via f32::to_bits (zero-extended).

§

Char

Plain char value (4-byte Unicode scalar). ADR-006 §2.7.5 amendment (Round 19 S1.5 W12-nativekind-scalar-additions, 2026-05-14): non-parametric scalar variant introduced for Array<char> v2-raw producer paths. char is Copy + 4-byte (UTF-32 scalar-value subset of u32) and fits the v2-raw TypedArray<T> flat-struct shape without Arc wrapping. Slot bits store the codepoint as c as u32 zero-extended into the low 32 bits of the 8-byte slot.

Parallel-discriminator note (CLAUDE.md §Parallel-implementation across producer/consumer carrier-shape boundaries): the existing NativeKind::Ptr(HeapKind::Char) carrier remains in source for inline-char-value paths that push char values directly to the VM stack without going through the §2.7.6/Q8 KindedSlot::from_char constructor. NativeKind::Char is the scalar-bucket carrier (the canonical §2.7.6/Q8 constructor target); NativeKind::Ptr(HeapKind::Char) is a per-element carrier label for the inline-codepoint payload pattern. Both labels are read-side-equivalent (slot bits in both shapes are c as u32 zero-extended), but consumer dispatch sites MUST handle either label exhaustively for correctness — the NativeKind::Char arm is the §Q8 carrier-API target, the Ptr(HeapKind::Char) arm is the pre-amendment inline-payload pattern. A future sub-cluster (cluster-1 hardening) folds the Ptr(HeapKind::Char) arms into NativeKind::Char exhaustively once the HeapKind::Char label can be retired.

§

Int8

Plain i8 value

§

NullableInt8

Nullable i8 value

§

UInt8

Plain u8 value

§

NullableUInt8

Nullable u8 value

§

Int16

Plain i16 value

§

NullableInt16

Nullable i16 value

§

UInt16

Plain u16 value

§

NullableUInt16

Nullable u16 value

§

Int32

Plain i32 value

§

NullableInt32

Nullable i32 value

§

UInt32

Plain u32 value

§

NullableUInt32

Nullable u32 value

§

Int64

Plain i64 value

§

NullableInt64

Nullable i64 value

§

UInt64

Plain u64 value

§

NullableUInt64

Nullable u64 value

§

IntSize

Plain isize value

§

NullableIntSize

Nullable isize value

§

UIntSize

Plain usize value

§

NullableUIntSize

Nullable usize value

§

Bool

Boolean value. Slot bits: 0 = false, 1 = true. Bool slots NEVER carry the null/unit sentinel — null is a distinct variant (NativeKind::Null) per the R5b-2-bool-null-sentinel disposition (ADR-006 §2.7 carrier-semantics + §2.7.7/Q9 parallel-kind track, 2026-05-19): pre-disposition (0u64, NativeKind::Bool) was the canonical null sentinel, which collided with legitimate false bool values (both encoded as bits=0). The collision caused VM-only divergence per W14.2-G6 SURFACE-G6-BOOL-NULL + SURFACE-G6-LET-ONLY-BODY + SURFACE-G6-NONE-OUTPUT-ADAPTER. Post-disposition: Bool slots carry only {0, 1} bits; null is pushed with NativeKind::Null discriminator (kind from the §2.7.7/Q9 parallel-kind track), restoring the kind-discriminator soundness invariant.

§

Null

Unit / null sentinel. Non-parametric scalar variant indicating the slot carries the absence-of-value marker (None / null / implicit unit return). R5b-2-bool-null-sentinel-cluster (ADR-006 §2.7 carrier semantics + §2.7.5 producer-side stamp + §2.7.7/Q9 parallel-kind track, 2026-05-19): introduced to fix the §2.7 (0u64, NativeKind::Bool) null-sentinel ⇔ false bool bit-pattern collision surfaced by W14.2-G6.

Slot bits are unspecified and ignored — the kind alone carries the absence signal. Producers use 0u64 by convention so uninitialized stack-pad bytes (already zero per push_kinded_slow) project to the same wire shape under NativeKind::Null if accidentally observed (defense in depth).

Clone/drop: no-op (no Arc<T> payload, no refcount work) — mirrors the inline-scalar arm of clone_with_kind / drop_with_kind per ADR-006 §2.7.7/Q9 + §2.7.6/Q8 dispatch tables.

Wire projection: WireValue::Null (mirrors the NullableFloat64 NaN-sentinel arm at slot_to_wire).

is_null_kinded: returns true for any (_, NativeKind::Null) pair regardless of bits — kind IS the discriminator per §2.7.7/Q9 (not “kind PLUS bit pattern of data slot”, which was the pre-disposition shape that the §2.7 collision exposed as unsound).

§

String

String reference (Arc raw pointer)

§

StringV2

v2-raw *const StringObj carrier reference. ADR-006 §2.7.5 amendment (Wave 2 Agent B W12-StringV2-DecimalV2-NativeKind-additions, 2026-05-14): new heap-pointer variant introduced for v2-raw Array<string> element read paths per TypedArray<*const StringObj> (Wave 2 §A2 producer migration). Slot bits store ptr as u64 where ptr: *const StringObj — retain/release uses v2_retain / v2_release against the HeapHeader at offset 0 of StringObj (NOT Arc::increment_strong_count — StringObj is a manually-allocated repr(C) carrier with its own refcount discipline per v2/refcount.rs, not an Arc<String>).

Parallel-discriminator note (CLAUDE.md §Parallel-implementation across producer/consumer carrier-shape boundaries): this variant is a per-carrier-shape discriminator distinct from NativeKind::String (Arc<String> carrier); the two are structurally distinct (StringObj is a repr(C) 24-byte HeapHeader-equipped struct, Arc<String> is a Rust-managed Arc<T> allocation). Mixing the two carriers under the same NativeKind discriminator is the H-b defection refused per the audit §H.2; the H-c decision (option adopted at §H.4 + supervisor §P.1 ratification 2026-05-14) gives each carrier its own NativeKind variant explicitly.

§

DecimalV2

v2-raw *const DecimalObj carrier reference. ADR-006 §2.7.5 amendment (Wave 2 Agent B W12-StringV2-DecimalV2-NativeKind-additions, 2026-05-14): new heap-pointer variant introduced for v2-raw Array<decimal> element read paths per TypedArray<*const DecimalObj> (Wave 2 §A2 producer migration). Slot bits store ptr as u64 where ptr: *const DecimalObj — retain/release uses v2_retain / v2_release against the HeapHeader at offset 0 of DecimalObj (NOT Arc::increment_strong_count against an Arc<rust_decimal::Decimal> — DecimalObj is a manually-allocated repr(C) carrier per v2/decimal_obj.rs + v2/refcount.rs).

Parallel-discriminator note (CLAUDE.md §Parallel-implementation across producer/consumer carrier-shape boundaries): this variant is a per-carrier-shape discriminator distinct from NativeKind::Ptr(HeapKind::Decimal) (Arc<rust_decimal::Decimal> carrier); the two are structurally distinct (DecimalObj is a repr(C) 24-byte HeapHeader-equipped struct, Arc<Decimal> is a Rust-managed Arc<T> allocation). Same H-c decision rationale as StringV2.

§

Ptr(HeapKind)

Heap pointer (Arc<HeapValue> raw pointer) whose HeapValue discriminant is kind. The marshal/wire/snapshot layer dispatches on kind to project the slot to its typed shape — it does not probe the heap object’s self-reported discriminant in production ((*hv).kind() == kind is a debug-only sanity check).

Watchlist (docs/defections.md 2026-05-06 — HeapKind trim + Ptr extension): do NOT add parametric NativeKind::Result(..), NativeKind::Option(..), or NativeKind::JsonValue variants when stdlib mass migration hits those returns. The strict-typed answer is HeapKind::TypedObject plus a per-instantiation schema_id from the function’s registered ConcreteType. Adding parametric NativeKind variants re-creates heterogeneous-by-default sum types at the discriminator level — the same defection pattern as the rejected enum SlotValue { Int, Float, Bool, Heap }.