Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. use std::sync::Arc;
  2. use std::sync::Mutex;
  3.  
  4. fn main() {
  5. let test = Arc::new(Mutex::new("test".to_string()));
  6. println!("{}", test.lock().unwrap());
  7. {
  8. let mut test2 = test.lock().unwrap();
  9. *test2 = "test2".to_string();
  10. }
  11. println!("{}", test.lock().unwrap());
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement