Skip to main content

decode_eval_result

Function decode_eval_result 

Source
pub fn decode_eval_result(
    store: impl AsContextMut,
    value: Option<Rooted<AnyRef>>,
    result_ty: Option<WasmType>,
    handles: &TypeHandles,
) -> Result<EvalValue>
Expand description

Decodes nomi-eval’s anyref return value into an EvalValue using the compile-time-known result type. None for the result_ty means the form was empty / definition-only and the host should see EvalValue::Nil. Numeric types (I32, Ratio, Commodity) and StringRef decode directly. PairRef walks the chain, decoding each car per its declared element type. EntityRef returns a placeholder until a downstream consumer needs the structured shape host-side. Takes any AsContextMut so it works with both &mut Store<T> (sync test paths) and &mut Caller<'_, T> (async host fn paths). handles resolves the module’s $t singleton and struct/array type handles (see super::type_handles::resolve_type_handles), needed to classify a heterogeneous AnyRef result by identity/kind (ADR-0033).