MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / typed

Method typed

crates/wasmtime/src/runtime/component/func.rs:139–145  ·  view source on GitHub ↗

Attempt to cast this [`Func`] to a statically typed [`TypedFunc`] with the provided `Params` and `Return`. This function will perform a type-check at runtime that the [`Func`] takes `Params` as parameters and returns `Return`. If the type-check passes then a [`TypedFunc`] will be returned which can be used to invoke the function in an efficient, statically-typed, and ergonomic manner. The `Param

(&self, store: impl AsContext)

Source from the content-addressed store, hash-verified

137 /// # }
138 /// ```
139 pub fn typed<Params, Return>(&self, store: impl AsContext) -> Result<TypedFunc<Params, Return>>
140 where
141 Params: ComponentNamedList + Lower,
142 Return: ComponentNamedList + Lift,
143 {
144 self._typed(store.as_context().0, None)
145 }
146
147 pub(crate) fn _typed<Params, Return>(
148 &self,

Callers

nothing calls this directly

Calls 2

_typedMethod · 0.80
as_contextMethod · 0.45

Tested by

no test coverage detected