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

Function import_section

crates/wizer/src/parse.rs:48–65  ·  view source on GitHub ↗
(
    module: &mut ModuleContext<'a>,
    imports: wasmparser::ImportSectionReader<'a>,
)

Source from the content-addressed store, hash-verified

46}
47
48fn import_section<'a>(
49 module: &mut ModuleContext<'a>,
50 imports: wasmparser::ImportSectionReader<'a>,
51) -> wasmtime::Result<()> {
52 // Check that we can properly handle all imports.
53 for imp in imports.into_imports() {
54 let imp = imp?;
55
56 if imp.module.starts_with("__wizer_") || imp.name.starts_with("__wizer_") {
57 wasmtime::bail!(
58 "input Wasm module already imports entities named with the `__wizer_*` prefix"
59 );
60 }
61
62 module.push_import(imp);
63 }
64 Ok(())
65}
66
67fn function_section<'a>(
68 module: &mut ModuleContext<'a>,

Callers 1

parse_withFunction · 0.85

Calls 2

OkFunction · 0.85
push_importMethod · 0.80

Tested by

no test coverage detected