Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use lazy_static::lazy_static;
- use std::sync::{Arc, Mutex};
- lazy_static!{
- static ref MY_LIST: Arc<Mutex<Vec<String>>> = {
- Arc::new(Mutex::new(vec!["item0".to_string()]))
- };
- }
- fn main() {
- println!("Hello, world!");
- MY_LIST.lock().unwrap().push("item1".to_string());
- read();
- }
- fn read() {
- println!("{:?}", MY_LIST.lock());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement