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

Method new

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

Creates a new [`Linker`]. The linker will define functions within the context of the `engine` provided and can only instantiate modules for a [`Store`][crate::Store] that is also defined within the same [`Engine`]. Usage of stores with different [`Engine`]s may cause a panic when used with this [`Linker`].

(engine: &Engine)

Source from the content-addressed store, hash-verified

158 /// that is also defined within the same [`Engine`]. Usage of stores with
159 /// different [`Engine`]s may cause a panic when used with this [`Linker`].
160 pub fn new(engine: &Engine) -> Linker<T> {
161 Linker {
162 engine: engine.clone(),
163 map: TryHashMap::new(),
164 pool: StringPool::new(),
165 allow_shadowing: false,
166 allow_unknown_exports: false,
167 _marker: marker::PhantomData,
168 }
169 }
170
171 /// Returns the [`Engine`] this is connected to.
172 pub fn engine(&self) -> &Engine {

Callers

nothing calls this directly

Calls 8

fromFunction · 0.85
ExternEnum · 0.70
newFunction · 0.50
cloneMethod · 0.45
to_stringMethod · 0.45
moduleMethod · 0.45
nameMethod · 0.45
tyMethod · 0.45

Tested by

no test coverage detected