Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created January 9, 2025 22:31
Show Gist options
  • Select an option

  • Save rust-play/bf691de710eb0c1dc918151ae76e736d to your computer and use it in GitHub Desktop.

Select an option

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