Guest User

Untitled

a guest
Feb 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. use lazy_static::lazy_static;
  2. use std::sync::{Arc, Mutex};
  3.  
  4. #[derive(Clone)]
  5. struct Struct {}
  6.  
  7. lazy_static! {
  8. static ref STRUCT: Arc<Mutex<Option<Struct>>> = Arc::new(Mutex::new(None));
  9. }
  10.  
  11. fn main()
  12. {
  13. let mut s = STRUCT.lock().unwrap();
  14. *s = Some(Struct{});
  15. }
Add Comment
Please, Sign In to add comment