Lesson 34 of 50 · rust
Async Await and Futures
Duration: 15 minutes
Lesson 34 of 50 · rust
Duration: 15 minutes
await keyword drives it to completion.\n\nrust\nuse std::future::Future;\n\nfn simple_future() -> impl Future<Output = i32> {\n async { 42 }\n}\n\n#[tokio::main]\nasync fn main() {\n let value = simple_future().await;\n println!(\"Future resolved to {}\", value);\n}\n\n