如何在同步函数中执行异步函数?
第一种:
xxx = futures::executor::block_on(asnyc_fn1()).unwrap_or_default();
第二种:
let mut rt = tokio::runtime::Builder::new()
.threaded_scheduler()
.enable_all()
.build()
.unwrap();
xxx = rt.block_on(asnyc_fn1()).unwrap_or_default();