use std::error::Error; use futures_executor::block_on; fn main() -> Result<(), Box> { let handle = block_on( clusterflux::spawn::task_with_arg(41_i32, |_| -> i32 { panic!("product-mode spawn invoked its local Rust closure") }) .task_id("task_add_one") .name("SDK product Wasmtime task") .env(clusterflux::env!("linux")) .start(), )?; let task_spec = handle .task_spec() .cloned() .ok_or("CLUSTERFLUX_SDK_COORDINATOR did not enable product runtime")?; let virtual_thread_id = handle.virtual_thread_id(); let result = block_on(handle.join())?; println!( "{}", serde_json::to_string(&serde_json::json!({ "kind": "clusterflux-sdk-product-runtime", "virtual_thread_id": virtual_thread_id, "task_spec": task_spec, "remote_result": result, "local_function_invoked_by_spawn": false, }))? ); Ok(()) }