-
-
Save RandyMcMillan/2c39246808bca28e473b901b01cd50d9 to your computer and use it in GitHub Desktop.
future_ready.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use futures::future::ready; | |
use std::future::Future; | |
async fn future_test() -> String { | |
"test".to_string() | |
} | |
fn future_test2() -> impl Future<Output=String> { | |
ready("test2".to_string()) | |
} | |
#[tokio::main] | |
async fn main() { | |
println!("{}", future_test().await); | |
println!("{}", future_test2().await); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment