macro_rules! async_block {
($($e:tt)*) => { ... };
}Expand description
Runs code in async environment
§Example
use wildbird::prelude::*;
async fn fetch_from_api() -> String {
std::thread::sleep(std::time::Duration::from_millis(100));
String::from("Ok")
}
trait Test {
fn get_response() -> String {
async_block! {
let res = fetch_from_api().await;
assert_eq!("Ok", res);
res
}
}
}