You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
461 B

pub mod agent;
pub mod connections;
pub mod env;
use std::future::Future;
use std::thread;
use tokio::runtime::Runtime;
// tokio runtime cannot be created inside another runtime,
// so i create a separate non-'static thread not to interfere
fn run_async<R: Send>(fut: impl Future<Output = R> + Send) -> R {
thread::scope(|s| {
s.spawn(|| Runtime::new().unwrap().block_on(fut))
.join()
.expect("async task failed")
})
}