-
-
Save rust-play/bf691de710eb0c1dc918151ae76e736d to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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