Struct wasm_component_layer::TypedFunc
source · pub struct TypedFunc<P: ComponentList, R: ComponentList> { /* private fields */ }Expand description
A strongly-typed component model function that can be called to interact with Instances.
Implementations§
source§impl<P: ComponentList, R: ComponentList> TypedFunc<P, R>
impl<P: ComponentList, R: ComponentList> TypedFunc<P, R>
sourcepub fn new<C: AsContextMut>(
ctx: C,
f: impl 'static + Send + Sync + Fn(StoreContextMut<'_, C::UserState, C::Engine>, P) -> Result<R>
) -> Self
pub fn new<C: AsContextMut>( ctx: C, f: impl 'static + Send + Sync + Fn(StoreContextMut<'_, C::UserState, C::Engine>, P) -> Result<R> ) -> Self
Creates a new function, wrapping the given closure.
sourcepub fn call(&self, ctx: impl AsContextMut, params: P) -> Result<R>
pub fn call(&self, ctx: impl AsContextMut, params: P) -> Result<R>
Calls this function, returning an error if:
- The store did not match the original.
- A trap occurred.
Trait Implementations§
source§impl<P: Clone + ComponentList, R: Clone + ComponentList> Clone for TypedFunc<P, R>
impl<P: Clone + ComponentList, R: Clone + ComponentList> Clone for TypedFunc<P, R>
Auto Trait Implementations§
impl<P, R> !RefUnwindSafe for TypedFunc<P, R>
impl<P, R> Send for TypedFunc<P, R>
impl<P, R> Sync for TypedFunc<P, R>
impl<P, R> Unpin for TypedFunc<P, R>
impl<P, R> !UnwindSafe for TypedFunc<P, R>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more