1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
// edition:2018 // check-pass use std::any::Any; use std::future::Future; struct Client(Box<dyn Any + Send>); impl Client { fn status(&self) -> u16 { 200 } } async fn get() {} pub fn foo() -> impl Future + Send { let client = Client(Box::new(true)); async move { match client.status() { 200 => { get().await; } _ => (), } } } fn main() {}