MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / imports

Method imports

crates/types/src/lib.rs:151–162  ·  view source on GitHub ↗

Returns an iterator over the module's import descriptors. The returned data mirrors the module's import section and preserves order.

(&self)

Source from the content-addressed store, hash-verified

149 ///
150 /// The returned data mirrors the module's import section and preserves order.
151 pub fn imports(&self) -> impl Iterator<Item = ModuleImport<'_>> {
152 self.0.imports.iter().filter_map(|import| {
153 let ty = match &import.kind {
154 ImportKind::Function(type_idx) => Some(ImportType::Func(self.0.func_types.get(*type_idx as usize)?)),
155 ImportKind::Table(table_ty) => Some(ImportType::Table(table_ty)),
156 ImportKind::Memory(memory_ty) => Some(ImportType::Memory(memory_ty)),
157 ImportKind::Global(global_ty) => Some(ImportType::Global(global_ty)),
158 }?;
159
160 Some(ModuleImport { module: import.module.as_ref(), name: import.name.as_ref(), ty })
161 })
162 }
163
164 /// Returns an iterator over the module's export descriptors.
165 ///

Calls 5

TableClass · 0.85
MemoryClass · 0.85
as_refMethod · 0.80
GlobalClass · 0.70
getMethod · 0.45