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

Method func_new_async

crates/wasmtime/src/runtime/linker.rs:479–498  ·  view source on GitHub ↗
(
        &mut self,
        module: &str,
        name: &str,
        ty: FuncType,
        func: F,
    )

Source from the content-addressed store, hash-verified

477 /// this linker.
478 #[cfg(feature = "async")]
479 pub fn func_new_async<F>(
480 &mut self,
481 module: &str,
482 name: &str,
483 ty: FuncType,
484 func: F,
485 ) -> Result<&mut Self>
486 where
487 F: for<'a> Fn(
488 Caller<'a, T>,
489 &'a [Val],
490 &'a mut [Val],
491 ) -> Box<dyn Future<Output = Result<()>> + Send + 'a>
492 + Send
493 + Sync
494 + 'static,
495 T: Send + 'static,
496 {
497 self.func_insert(module, name, HostFunc::new_async(&self.engine, ty, func)?)
498 }
499
500 /// Define a host function within this linker.
501 ///

Calls 1

func_insertMethod · 0.80

Tested by

no test coverage detected