Looks up an export in this [`Module`] by name to get its index. This function will return the index of an export with the given name. This can be useful to avoid the cost of looking up the export by name multiple times. Instead the [`ModuleExport`] can be stored and used to look up the export on the [`Instance`](crate::Instance) later.
(&self, name: &str)
| 893 | /// [`ModuleExport`] can be stored and used to look up the export on the |
| 894 | /// [`Instance`](crate::Instance) later. |
| 895 | pub fn get_export_index(&self, name: &str) -> Option<ModuleExport> { |
| 896 | let compiled_module = self.compiled_module(); |
| 897 | let module = compiled_module.module(); |
| 898 | let name = module.strings.get_atom(name)?; |
| 899 | let entity = *module.exports.get(&name)?; |
| 900 | Some(ModuleExport { |
| 901 | module: self.id(), |
| 902 | entity, |
| 903 | }) |
| 904 | } |
| 905 | |
| 906 | /// Returns the [`Engine`] that this [`Module`] was compiled by. |
| 907 | pub fn engine(&self) -> &Engine { |