Skip to content

Instantly share code, notes, and snippets.

@ejangi
Created June 6, 2024 21:57
Show Gist options
  • Save ejangi/72fb653ddac526f8db40de8759d922a7 to your computer and use it in GitHub Desktop.
Save ejangi/72fb653ddac526f8db40de8759d922a7 to your computer and use it in GitHub Desktop.
use tokio::runtime::Runtime;
async fn async_task() -> i32 {
// Your asynchronous code here
42
}
fn main() {
let rt = Runtime::new().unwrap();
let result = rt.block_on(async_task());
println!("Result: {}", result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment