use shared::Shared; #[derive(Clone)] struct Person { pub name: String, pub age: u16, } // Using it as a parameter async fn get_older(shared: Shared) { let mut person = shared.lock().await; person.age += 1; } #[tokio::main] async fn main() { let shared_data = Shared::new(Person { name: "Test Dummy".to_string(), age: 30, }); { // Direct access let person = shared_data.lock().await; println!("Before:"); println!("Person{{name: {}, age: {}}}", person.name, person.age); } // Calling get_older(shared_data.clone()).await; { let person = shared_data.lock().await; println!("After:"); println!("Person{{name: {}, age: {}}}", person.name, person.age); } }