Use embedded API in the wasmtime-rust (#540)

This commit is contained in:
Yury Delendik
2019-11-13 09:15:37 -06:00
committed by Alex Crichton
parent 2737c5e8e5
commit 98266498af
13 changed files with 316 additions and 112 deletions

View File

@@ -180,6 +180,34 @@ impl Into<AnyRef> for Val {
}
}
impl From<RuntimeValue> for Val {
fn from(rv: RuntimeValue) -> Self {
match rv {
RuntimeValue::I32(i) => Val::I32(i),
RuntimeValue::I64(i) => Val::I64(i),
RuntimeValue::F32(u) => Val::F32(u),
RuntimeValue::F64(u) => Val::F64(u),
x => {
panic!("unsupported {:?}", x);
}
}
}
}
impl Into<RuntimeValue> for Val {
fn into(self) -> RuntimeValue {
match self {
Val::I32(i) => RuntimeValue::I32(i),
Val::I64(i) => RuntimeValue::I64(i),
Val::F32(u) => RuntimeValue::F32(u),
Val::F64(u) => RuntimeValue::F64(u),
x => {
panic!("unsupported {:?}", x);
}
}
}
}
pub(crate) fn into_checked_anyfunc(
val: Val,
store: &HostRef<Store>,