Expand description
Conversion between runtime values and wire format.
Phase 2b kind-threaded rewrite. Public functions take (bits: u64, kind: NativeKind) pairs threaded from the FunctionBlob’s compile-
time slot-kind metadata; internal dispatch is a match kind { ... }
with no tag-bit probing. Heap slots use NativeKind::Ptr(HeapKind) —
the kind tells the dispatcher which HeapValue arm decodes the
bits without probing the heap object’s self-reported discriminant
in production (debug-only consistency check).
See docs/defections.md 2026-05-06 (Phase 2b unified marshal +
wire/snapshot kind threading) for the architectural rationale.
§API
slot_to_wire— project (bits, kind) into aWireValue.wire_to_slot— project aWireValueinto typed slot bits, given theexpected_kindthe caller wants. ReturnsResult<u64, MarshalError>.slot_to_envelope— wrap a typed slot in aValueEnvelopewith metadata.slot_extract_content— extract Content node renderings from a slot whose kind says it carries Content / DataTable / TableView.datatable_to_wire/datatable_to_ipc_bytes/datatable_from_ipc_bytes— typedDataTable↔ wire/IPC.
Functions§
- datatable_
from_ ipc_ bytes - datatable_
to_ ipc_ bytes - datatable_
to_ wire - heap_
value_ to_ wire - Project a
&HeapValuetoWireValueby dispatching on its surviving variants. Reused by the snapshot path (Phase 2b snapshot.rs commit) which has the same heap projection needs. - slot_
extract_ content - If the slot carries a renderable Content shape (Content node, DataTable,
or TableView), return
(content_json, content_html, content_terminal). Otherwise all three areNone. - slot_
to_ envelope - Wrap a typed slot in a
ValueEnvelopewith optional metadata. - slot_
to_ wire - Project a typed slot’s
(bits, kind)to aWireValue. - wire_
to_ slot - Project a
WireValueto typed slot bits, given the kind the caller wants. Returns [MarshalError::KindMismatch] when wire shape doesn’t match the expected kind.