Looks up a previously defined value in this [`Linker`], identified by the names provided. Returns an error if this name was not previously defined in this [`Linker`]. # Panics This function will panic if the `store` provided does not come from the same [`Engine`] that this linker was created with. # Errors This function will return an [`OutOfMemory`][crate::OutOfMemory] error when memory allo
(
&self,
mut store: impl AsContextMut<Data = T>,
module: &str,
name: &str,
)
| 1286 | /// memory allocation fails. See the `OutOfMemory` type's documentation for |
| 1287 | /// details on Wasmtime's out-of-memory handling. |
| 1288 | pub fn get( |
| 1289 | &self, |
| 1290 | mut store: impl AsContextMut<Data = T>, |
| 1291 | module: &str, |
| 1292 | name: &str, |
| 1293 | ) -> Result<Extern> |
| 1294 | where |
| 1295 | T: 'static, |
| 1296 | { |
| 1297 | let store = store.as_context_mut().0; |
| 1298 | match self._get(module, name) { |
| 1299 | // Safety: `T` is connecting the linker and store. |
| 1300 | Some(def) => Ok(unsafe { def.to_extern(store)? }), |
| 1301 | None => bail!("missing definition for `{module}::{name}`"), |
| 1302 | } |
| 1303 | } |
| 1304 | |
| 1305 | fn _get(&self, module: &str, name: &str) -> Option<&Definition> { |
| 1306 | let key = ImportKey { |
no test coverage detected