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

Method get_export

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

Looks up an export in this [`Module`] by name. This function will return the type of an export with the given name. # Examples There may be no export with that name: ``` # use wasmtime::*; # fn main() -> Result<()> { # let engine = Engine::default(); let module = Module::new(&engine, "(module)")?; assert!(module.get_export("foo").is_none()); # Ok(()) # } ``` When there is an export with that

(&self, name: &str)

Source from the content-addressed store, hash-verified

876 /// # }
877 /// ```
878 pub fn get_export(&self, name: &str) -> Option<ExternType> {
879 let module = self.compiled_module().module();
880 let name = module.strings.get_atom(name)?;
881 let entity_index = module.exports.get(&name)?;
882 Some(ExternType::from_wasmtime(
883 self.engine(),
884 self.types(),
885 &module.type_of(*entity_index),
886 ))
887 }
888
889 /// Looks up an export in this [`Module`] by name to get its index.
890 ///

Callers

nothing calls this directly

Calls 7

compiled_moduleMethod · 0.80
get_atomMethod · 0.80
moduleMethod · 0.45
getMethod · 0.45
engineMethod · 0.45
typesMethod · 0.45
type_ofMethod · 0.45

Tested by

no test coverage detected