MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / load_ty

Method load_ty

crates/wasmtime/src/runtime/values.rs:164–189  ·  view source on GitHub ↗
(&self, store: &StoreOpaque)

Source from the content-addressed store, hash-verified

162
163 #[inline]
164 pub(crate) fn load_ty(&self, store: &StoreOpaque) -> Result<ValType> {
165 Ok(match self {
166 Val::I32(_) => ValType::I32,
167 Val::I64(_) => ValType::I64,
168 Val::F32(_) => ValType::F32,
169 Val::F64(_) => ValType::F64,
170 Val::V128(_) => ValType::V128,
171 Val::ExternRef(Some(_)) => ValType::EXTERNREF,
172 Val::ExternRef(None) => ValType::NULLFUNCREF,
173 Val::FuncRef(None) => ValType::NULLFUNCREF,
174 Val::FuncRef(Some(f)) => ValType::Ref(RefType::new(
175 false,
176 HeapType::ConcreteFunc(f.load_ty(store)),
177 )),
178 Val::AnyRef(None) => ValType::NULLREF,
179 Val::AnyRef(Some(a)) => ValType::Ref(RefType::new(false, a._ty(store)?)),
180 Val::ExnRef(None) => ValType::NULLEXNREF,
181 Val::ExnRef(Some(e)) => ValType::Ref(RefType::new(false, e._ty(store)?.into())),
182 Val::ContRef(_) => {
183 // TODO(#10248): Return proper continuation reference type when available
184 return Err(crate::format_err!(
185 "continuation references not yet supported in embedder API"
186 ));
187 }
188 })
189 }
190
191 /// Does this value match the given type?
192 ///

Callers 2

tyMethod · 0.45
ensure_matches_tyMethod · 0.45

Calls 5

OkFunction · 0.85
is_nullMethod · 0.80
RefEnum · 0.70
newFunction · 0.50
_tyMethod · 0.45

Tested by

no test coverage detected