Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. use lazy_static::lazy_static;
  2. use std::sync::{Arc, Mutex};
  3.  
  4. lazy_static!{
  5. static ref MY_LIST: Arc<Mutex<Vec<String>>> = {
  6. Arc::new(Mutex::new(vec!["item0".to_string()]))
  7. };
  8. }
  9.  
  10. fn main() {
  11. println!("Hello, world!");
  12. MY_LIST.lock().unwrap().push("item1".to_string());
  13.  
  14. read();
  15. }
  16.  
  17. fn read() {
  18. println!("{:?}", MY_LIST.lock());
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement