pub struct Func { /* private fields */ }
Expand description
A component model function that may be invoked to interact with an Instance
.
Implementations§
Source§impl Func
impl Func
Sourcepub fn new<C: AsContextMut>(
ctx: C,
ty: FuncType,
f: impl 'static + Send + Sync + Fn(StoreContextMut<'_, C::UserState, C::Engine>, &[Value], &mut [Value]) -> Result<()>,
) -> Self
pub fn new<C: AsContextMut>( ctx: C, ty: FuncType, f: impl 'static + Send + Sync + Fn(StoreContextMut<'_, C::UserState, C::Engine>, &[Value], &mut [Value]) -> Result<()>, ) -> Self
Creates a new function with the provided type and arguments.
Sourcepub fn call<C: AsContextMut>(
&self,
ctx: C,
arguments: &[Value],
results: &mut [Value],
) -> Result<()>
pub fn call<C: AsContextMut>( &self, ctx: C, arguments: &[Value], results: &mut [Value], ) -> Result<()>
Calls this function, returning an error if:
- The store did not match the original.
- The arguments or results did not match the signature.
- A trap occurred.
Sourcepub fn typed<P: ComponentList, R: ComponentList>(
&self,
) -> Result<TypedFunc<P, R>>
pub fn typed<P: ComponentList, R: ComponentList>( &self, ) -> Result<TypedFunc<P, R>>
Converts this function to a TypedFunc
, failing if the signatures do not match.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Func
impl !RefUnwindSafe for Func
impl Send for Func
impl Sync for Func
impl Unpin for Func
impl !UnwindSafe for Func
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