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

Function export_section

crates/wizer/src/parse.rs:107–132  ·  view source on GitHub ↗
(
    module: &mut ModuleContext<'a>,
    exports: wasmparser::ExportSectionReader<'a>,
)

Source from the content-addressed store, hash-verified

105}
106
107fn export_section<'a>(
108 module: &mut ModuleContext<'a>,
109 exports: wasmparser::ExportSectionReader<'a>,
110) -> wasmtime::Result<()> {
111 for export in exports {
112 let export = export?;
113
114 if export.name.starts_with("__wizer_") {
115 wasmtime::bail!(
116 "input Wasm module already exports entities named with the `__wizer_*` prefix"
117 );
118 }
119
120 match export.kind {
121 wasmparser::ExternalKind::Tag
122 | wasmparser::ExternalKind::Func
123 | wasmparser::ExternalKind::FuncExact
124 | wasmparser::ExternalKind::Table
125 | wasmparser::ExternalKind::Memory
126 | wasmparser::ExternalKind::Global => {
127 module.push_export(export);
128 }
129 }
130 }
131 Ok(())
132}

Callers 1

parse_withFunction · 0.85

Calls 2

OkFunction · 0.85
push_exportMethod · 0.45

Tested by

no test coverage detected