1 use async_trait::async_trait; 2 use std::sync::Mutex; 3 f()4async fn f() {} 5 6 #[async_trait] 7 trait Test { test(&self)8 async fn test(&self) { 9 let mutex = Mutex::new(()); 10 let _guard = mutex.lock().unwrap(); 11 f().await; 12 } 13 test_ret(&self) -> bool14 async fn test_ret(&self) -> bool { 15 let mutex = Mutex::new(()); 16 let _guard = mutex.lock().unwrap(); 17 f().await; 18 true 19 } 20 } 21 main()22fn main() {} 23