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)
| 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 | /// |