Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use lazy_static::lazy_static;
- use std::sync::{Arc, Mutex};
- #[derive(Clone)]
- struct Struct {}
- lazy_static! {
- static ref STRUCT: Arc<Mutex<Option<Struct>>> = Arc::new(Mutex::new(None));
- }
- fn main()
- {
- let mut s = STRUCT.lock().unwrap();
- *s = Some(Struct{});
- }
Add Comment
Please, Sign In to add comment