Skip to main content

register_typed_function

Function register_typed_function 

Source
pub fn register_typed_function<F>(
    module: &mut ModuleExports,
    name: impl Into<String>,
    description: impl Into<String>,
    params: Vec<ModuleParam>,
    return_type: ConcreteType,
    body: F,
)
where F: for<'ctx> Fn(&[KindedSlot], &ModuleContext<'ctx>) -> Result<TypedReturn, String> + Send + Sync + 'static,
Expand description

Register a native function whose body inspects a variadic KindedSlot slice.

Per ADR-006 §2.7.4 ruling, the variadic helper is the §2.7.1.4 dispatch-slice case — KindedSlot is the right carrier because the kind-per-position is determined by the registered ModuleParam schema, not by FromSlot constraints on the body’s Rust signature. Conversion from raw &[u64] to &[KindedSlot] happens inside the runtime-side wrapper installed below; the body sees the typed carrier directly.