use std::sync::{Arc, Mutex};
use std::collections::VecDeque;
use std::thread::{self, sleep};
use rand::Rng;
use std::time::Duration;fn main() {let list: Arc<Mutex<VecDeque<String>>> = Arc::new(Mutex::new(VecDeque::new()));let list_clone = list.clone();let mutator = thread::spawn(move || {let mut rng = rand::thread_rng();loop {let random_operation = rng.gen_range(0..3); let value = rng.gen_range(1..101).to_string(); let mut list_guard = list_clone.lock().unwrap(); match random_operation {0 => list_guard.push_front(value.clone()), 1 => list_guard.push_back(value.clone()), 2 => {if let Some(_) = list_guard.pop_front() {} }_ => {}}drop(list_guard); thread::sleep(Duration::from_millis(100)); }});let list_clone = list.clone();let observer = thread::spawn(move || {loop {let list_guard = list_clone.lock().unwrap(); println!("Current state of the deque: {:?}", list_guard);drop(list_guard); thread::sleep(Duration::from_millis(500)); }});let _ = mutator.join();let _ = observer.join();}