1 extern crate spin; 2 main()3fn main() { 4 let mutex = spin::Mutex::new(42); 5 println!("{:?}", mutex); 6 { 7 let x = mutex.lock(); 8 println!("{:?}, {:?}", mutex, *x); 9 } 10 11 let rwlock = spin::RwLock::new(42); 12 println!("{:?}", rwlock); 13 { 14 let x = rwlock.read(); 15 println!("{:?}, {:?}", rwlock, *x); 16 } 17 { 18 let x = rwlock.write(); 19 println!("{:?}, {:?}", rwlock, *x); 20 } 21 } 22