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

Method get

crates/wasmtime/src/runtime/linker.rs:1288–1303  ·  view source on GitHub ↗

Looks up a previously defined value in this [`Linker`], identified by the names provided. Returns an error if this name was not previously defined in this [`Linker`]. # Panics This function will panic if the `store` provided does not come from the same [`Engine`] that this linker was created with. # Errors This function will return an [`OutOfMemory`][crate::OutOfMemory] error when memory allo

(
        &self,
        mut store: impl AsContextMut<Data = T>,
        module: &str,
        name: &str,
    )

Source from the content-addressed store, hash-verified

1286 /// memory allocation fails. See the `OutOfMemory` type's documentation for
1287 /// details on Wasmtime's out-of-memory handling.
1288 pub fn get(
1289 &self,
1290 mut store: impl AsContextMut<Data = T>,
1291 module: &str,
1292 name: &str,
1293 ) -> Result<Extern>
1294 where
1295 T: 'static,
1296 {
1297 let store = store.as_context_mut().0;
1298 match self._get(module, name) {
1299 // Safety: `T` is connecting the linker and store.
1300 Some(def) => Ok(unsafe { def.to_extern(store)? }),
1301 None => bail!("missing definition for `{module}::{name}`"),
1302 }
1303 }
1304
1305 fn _get(&self, module: &str, name: &str) -> Option<&Definition> {
1306 let key = ImportKey {

Callers 15

compile_with_inliningMethod · 0.45
link_and_append_codeMethod · 0.45
define_funcMethod · 0.45
register_functionMethod · 0.45
sampling_threadFunction · 0.45
enter_wasmMethod · 0.45
exit_wasmMethod · 0.45
func_refMethod · 0.45
get_exportMethod · 0.45

Calls 4

OkFunction · 0.85
as_context_mutMethod · 0.45
_getMethod · 0.45
to_externMethod · 0.45

Tested by

no test coverage detected