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

Method imports

crates/wasmtime/src/runtime/module.rs:753–763  ·  view source on GitHub ↗

Returns the list of imports that this [`Module`] has and must be satisfied. This function returns the list of imports that the wasm module has, but only the types of each import. The type of each import is used to typecheck the [`Instance::new`](crate::Instance::new) method's `imports` argument. The arguments to that function must match up 1-to-1 with the entries in the array returned here. The

(
        &'module self,
    )

Source from the content-addressed store, hash-verified

751 /// # }
752 /// ```
753 pub fn imports<'module>(
754 &'module self,
755 ) -> impl ExactSizeIterator<Item = ImportType<'module>> + 'module {
756 let module = self.compiled_module().module();
757 let types = self.types();
758 let engine = self.engine();
759 module.imports().map(move |(imp_mod, imp_field, ty)| {
760 debug_assert!(ty.is_canonicalized_for_runtime_usage());
761 ImportType::new(imp_mod, imp_field, ty, types, engine)
762 })
763 }
764
765 /// Returns the list of exports that this [`Module`] has and will be
766 /// available after instantiation.

Callers 6

typecheckFunction · 0.45
_instantiate_preMethod · 0.45
make_externsFunction · 0.45
add_to_linkerFunction · 0.45

Calls 6

compiled_moduleMethod · 0.80
newFunction · 0.50
moduleMethod · 0.45
typesMethod · 0.45
engineMethod · 0.45
mapMethod · 0.45

Tested by 1

make_externsFunction · 0.36