Expand description
Strict-typed marshal layer for native module function dispatch.
Replaces the deleted Fn(&[ValueWord], &ModuleContext) -> Result<ValueWord>
body shape (the dynamic-FFI escape hatch). Native function bodies now
take typed Rust arguments that implement FromSlot; the function’s
Rust signature is the typed signature, and the marshal layer cannot be
registered against mismatching kinds because the Rust trait system rejects
the [register_typed_fn_N] generic constraints.
Mirrors the structural-enforcement track from Phase 2a: forbidden
mismatches are unrepresentable, not just unreachable. See
docs/defections.md 2026-05-06 (Phase 2b unified marshal + wire/snapshot).
§What’s here
FromSlot/ToSlot: read/write a typed value from/to an 8-byteu64slot. Each impl pins a singleNativeKindvia the associated constant.MarshalError: typed error returned by the marshal boundary.register_typed_fn_0…register_typed_fn_3: per-arity registration helpers. Each wraps a body whose Rust parameter types carry the typed argument contract (eachPi: FromSlot).
§What’s not here yet
- Higher-arity helpers (4+) — added on demand when stdlib migrations need them.
ToSlotfor containerTypedReturnvariants (Ok/Err/Some/ObjectPairs/etc.) — these need monomorphized heap representations and land alongside the per-stdlib-module migrations in Phase 2c.
Enums§
- Marshal
Error - Typed error returned at the marshal boundary.
Traits§
- From
Slot - Read a typed value from an 8-byte raw-bits slot.
- ToSlot
- Write a typed value into an 8-byte raw-bits slot.
Functions§
- register_
typed_ async_ fn_ 1 - Register a 1-arg async native function. Body returns a
Future; the dispatcher blocks on it at the call boundary. - register_
typed_ async_ fn_ 2 - Register a 2-arg async native function.
- register_
typed_ async_ fn_ 3 - Register a 3-arg async native function.
- register_
typed_ async_ fn_ 1_ full - Register a 1-arg async native function with full param spec.
- register_
typed_ async_ fn_ 2_ full - Register a 2-arg async native function with full param spec.
- register_
typed_ async_ fn_ 3_ full - Register a 3-arg async native function with full param spec.
- register_
typed_ async_ function - Register an async native function whose body inspects a variadic
KindedSlotvector. - register_
typed_ fn_ 0 - Register a 0-arg native function whose body takes only the
ModuleContextand returns aTypedReturn. - register_
typed_ fn_ 1 - Register a 1-arg native function. The body’s
P0parameter type declares the typed contract viaFromSlot::NATIVE_KIND— there is no separate kind annotation to keep in sync. - register_
typed_ fn_ 2 - Register a 2-arg native function.
- register_
typed_ fn_ 3 - Register a 3-arg native function.
- register_
typed_ fn_ 4 - Register a 4-arg native function with positional
(name, type)param spec. - register_
typed_ fn_ 5 - Register a 5-arg native function with positional
(name, type)param spec. - register_
typed_ fn_ 6 - Register a 6-arg native function with positional
(name, type)param spec. - register_
typed_ fn_ 1_ full - Register a 1-arg native function with full param spec (per-arg
required+default_snippet). - register_
typed_ fn_ 2_ full - Register a 2-arg native function with full param spec.
- register_
typed_ fn_ 3_ full - Register a 3-arg native function with full param spec.
- register_
typed_ fn_ 4_ full - Register a 4-arg native function with full param spec.
- register_
typed_ fn_ 5_ full - Register a 5-arg native function with full param spec.
- register_
typed_ fn_ 6_ full - Register a 6-arg native function with full param spec.
- register_
typed_ function - Register a native function whose body inspects a variadic
KindedSlotslice.
Type Aliases§
- Variadic
Typed Async Body - Body signature for a
register_typed_async_functioncaller. - Variadic
Typed Body - Body signature for a
register_typed_functioncaller.