inkpad_executor/wasmi/
value.rs

1//! Implementation of wasmi return value
2use crate::derive::Value;
3use ::wasmi::RuntimeValue;
4
5impl From<RuntimeValue> for Value {
6    fn from(v: RuntimeValue) -> Value {
7        match v {
8            RuntimeValue::I32(v) => Value::I32(v),
9            RuntimeValue::I64(v) => Value::I64(v),
10            RuntimeValue::F32(v) => Value::F32(v.into()),
11            RuntimeValue::F64(v) => Value::F64(v.into()),
12        }
13    }
14}
15
16impl From<Value> for RuntimeValue {
17    fn from(v: Value) -> RuntimeValue {
18        match v {
19            Value::I32(v) => RuntimeValue::I32(v),
20            Value::I64(v) => RuntimeValue::I64(v),
21            Value::F32(v) => RuntimeValue::F32(v.into()),
22            Value::F64(v) => RuntimeValue::F64(v.into()),
23        }
24    }
25}