Skip to content

Instantly share code, notes, and snippets.

@RandyMcMillan
Forked from rust-play/playground.rs
Last active January 10, 2025 16:29
Show Gist options
  • Save RandyMcMillan/2c39246808bca28e473b901b01cd50d9 to your computer and use it in GitHub Desktop.
Save RandyMcMillan/2c39246808bca28e473b901b01cd50d9 to your computer and use it in GitHub Desktop.
future_ready.rs
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