Looks up an exported function by name within this [`Instance`]. The `store` argument provided must be the store that this instance lives within and the `name` argument is the lookup key by which to find the exported function. If the function is found then `Some` is returned and otherwise `None` is returned. The `name` here can be a string such as `&str` or it can be a [`ComponentExportIndex`] wh
(&self, mut store: impl AsContextMut, name: impl ExportLookup)
| 153 | /// # } |
| 154 | /// ``` |
| 155 | pub fn get_func(&self, mut store: impl AsContextMut, name: impl ExportLookup) -> Option<Func> { |
| 156 | let store = store.as_context_mut().0; |
| 157 | let instance = self.id.get(store); |
| 158 | let component = instance.component(); |
| 159 | |
| 160 | // Validate that `name` exists within `self.` |
| 161 | let index = name.lookup(component, None)?; |
| 162 | |
| 163 | // Validate that `index` is indeed a lifted function. |
| 164 | match &component.env_component().export_items[index] { |
| 165 | Export::LiftedFunction { .. } => {} |
| 166 | _ => return None, |
| 167 | } |
| 168 | |
| 169 | // And package up the indices! |
| 170 | Some(Func::from_lifted_func(*self, index)) |
| 171 | } |
| 172 | |
| 173 | /// Looks up an exported [`Func`] value by name and with its type. |
| 174 | /// |
no test coverage detected