Get a typed function export by name. ## Example ```rust # fn main() -> tinywasm::Result<()> { # use tinywasm::{ModuleInstance, Store}; # let wasm = wat::parse_str(r#" # (module # (func (export "add") (param i32 i32) (result i32) # local.get 0 # local.get 1 # i32.add)) # "#).expect("valid wat"); # let module = tinywasm::parse_bytes(&wasm)?; # let mut store = Store
(
&self,
store: &Store,
name: &str,
)
| 480 | /// For signatures that exceed tuple arity 12, see [`crate::WasmTupleChain`], which can be used |
| 481 | /// directly as `instance.func::<crate::WasmTupleChain<_, _>, _>(...)`. |
| 482 | pub fn func<P: IntoWasmValues + ToWasmTypes, R: FromWasmValues + ToWasmTypes>( |
| 483 | &self, |
| 484 | store: &Store, |
| 485 | name: &str, |
| 486 | ) -> Result<FunctionTyped<P, R>> { |
| 487 | let func = self.func_untyped(store, name)?; |
| 488 | Self::validate_typed_func::<P, R>(&func, name)?; |
| 489 | Ok(FunctionTyped { func, marker: core::marker::PhantomData }) |
| 490 | } |
| 491 | |
| 492 | /// Get a typed function by its module-local index. |
| 493 | #[cfg_attr(docsrs, doc(cfg(feature = "guest-debug")))] |
nothing calls this directly
no test coverage detected