use std::{ collections::HashMap, sync::{Arc, Mutex}, }; #[derive(Clone)] pub struct Resolver { data: Arc>>, } impl Default for Resolver { fn default() -> Self { Self { data: Arc::new(Mutex::new(HashMap::new())), } } } impl Resolver { pub fn get(&self, key: K) -> V { self.data.lock().unwrap().get(&key).unwrap().clone() } pub fn put(&self, key: K, value: V) { self.data.lock().unwrap().insert(key, value); } }