async_calls/
async_calls.rs

1use whynot::{new_runtime, RuntimeConfig, RuntimeKind};
2use whynot::process::ProcRuntime;
3
4fn main() {
5    let cfg = RuntimeConfig { debug: false, ..Default::default() };
6    let _rt = new_runtime(RuntimeKind::Process(cfg.clone())).unwrap();
7
8    let h1 = ProcRuntime::call_async_with_cfg(cfg.clone(), "greet".to_string(), vec!["Milton".into()]);
9    let h2 = ProcRuntime::call_async_with_cfg(cfg.clone(), "add".to_string(), vec![7.into(), 9.into()]);
10
11    let r1 = h1.join().unwrap().unwrap();
12    let r2 = h2.join().unwrap().unwrap();
13
14    println!("greet: {:?}", r1.result);
15    println!("add: {:?}", r2.result);
16}