Closed ufosky closed 4 years ago
Either use
futures::executor::block_on(your_future)
or
use runtime_tokio::Tokio;
fn main() {
runtime::raw::enter(Tokio, your_future);
}
If you want to run it using this crate.
We could / should probably expose some convenience methods here, so nobody ever needs to use runtime::raw
directly:
#[runtime::main]
runtime::task::block_on(async move {
/* code goes here */
})
#[runtime::main]
runtime_tokio::Tokio::block_on(async move {
/* code goes here */
})
I found if I use an async function, the other codes using this function must implement as an async function. Is there some suggestion for using async function from normal function?