Function lunatic_process::wasm::spawn_wasm
source · pub async fn spawn_wasm<S>(
env: Arc<dyn Environment>,
runtime: WasmtimeRuntime,
module: &WasmtimeCompiledModule<S>,
state: S,
function: &str,
params: Vec<Val>,
link: Option<(Option<i64>, Arc<dyn Process>)>
) -> Result<(JoinHandle<Result<S>>, Arc<dyn Process>)>where
S: ProcessState + Send + Sync + ResourceLimiter + 'static,
Expand description
Spawns a new wasm process from a compiled module.
A Process
is created from a module
, entry function
, array of arguments and config. The
configuration will define some characteristics of the process, such as maximum memory, fuel
and host function properties (filesystem access, networking, ..).
After it’s spawned the process will keep running in the background. A process can be killed
with Signal::Kill
signal. If you would like to block until the process is finished you can
.await
on the returned JoinHandle<()>
.