async fn — compiler-generated. Pin<Box<dyn Future>> — explicit.
async fn:
Pin<Box<dyn Future>>:
1// Async fn2async fn get_data() -> String {3 String::from("data")4}56// Explicit Future7use std::future::Future;8use std::pin::Pin;910fn get_data() -> Pin<Box<dyn Future<Output = String> + Send>> {11 Box::pin(async {12 String::from("data")13 })14}
Key: async fn for simplicity, explicit Future for flexibility.