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

Method define_name

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

Same as [`Linker::define`], except only the name of the import is provided, not a module name as well. This is only relevant when working with the module linking proposal where one-level names are allowed (in addition to two-level names). Otherwise this method need not be used. # Errors This function will return an [`OutOfMemory`][crate::OutOfMemory] error when memory allocation fails. See the

(
        &mut self,
        store: impl AsContext<Data = T>,
        name: &str,
        item: impl Into<Extern>,
    )

Source from the content-addressed store, hash-verified

388 /// memory allocation fails. See the `OutOfMemory` type's documentation for
389 /// details on Wasmtime's out-of-memory handling.
390 pub fn define_name(
391 &mut self,
392 store: impl AsContext<Data = T>,
393 name: &str,
394 item: impl Into<Extern>,
395 ) -> Result<&mut Self>
396 where
397 T: 'static,
398 {
399 let store = store.as_context();
400 let key = self.import_key(name, None)?;
401 self.insert(key, Definition::new(store.0, item.into()))?;
402 Ok(self)
403 }
404
405 fn func_insert(&mut self, module: &str, name: &str, func: HostFunc) -> Result<&mut Self>
406 where

Callers 2

linker_define_nameFunction · 0.80
wizen_and_run_wasmFunction · 0.80

Calls 5

OkFunction · 0.85
import_keyMethod · 0.80
newFunction · 0.50
as_contextMethod · 0.45
insertMethod · 0.45

Tested by 2

linker_define_nameFunction · 0.64
wizen_and_run_wasmFunction · 0.64