(store: impl wasmtime::AsContextMut, val: Val)
| 43 | |
| 44 | impl WasmValue { |
| 45 | pub(crate) fn new(store: impl wasmtime::AsContextMut, val: Val) -> Result<WasmValue> { |
| 46 | Ok(match val { |
| 47 | Val::ExnRef(Some(rooted)) => { |
| 48 | WasmValue::Exn(Some(rooted.to_owned_rooted(store).unwrap())) |
| 49 | } |
| 50 | Val::ExnRef(None) => WasmValue::Exn(None), |
| 51 | Val::FuncRef(Some(f)) => WasmValue::Func(Some(f)), |
| 52 | Val::FuncRef(None) => WasmValue::Func(None), |
| 53 | Val::ExternRef(_) | Val::AnyRef(_) | Val::ContRef(_) => { |
| 54 | return Err(wit::Error::UnsupportedType.into()); |
| 55 | } |
| 56 | Val::I32(_) | Val::I64(_) | Val::F32(_) | Val::F64(_) | Val::V128(_) => { |
| 57 | WasmValue::Primitive(val) |
| 58 | } |
| 59 | }) |
| 60 | } |
| 61 | |
| 62 | pub(crate) fn into_val(self, store: impl wasmtime::AsContextMut) -> Val { |
| 63 | match self { |
nothing calls this directly
no test coverage detected