INNER CODE UNIT · Rust

default

xoriors/rencfs · src/arc_hashmap.rs:38

    fn default() -> Self {
        Self {
            map: RwLock::new(HashMap::new()),
        }
    }
}

impl<K: Eq + Hash, V> ArcHashMap<K, V> {
    pub fn insert(&self, key: K, value: V) -> Holder<'_, K, V> {
        self.get_or_insert_with(key, || value)
    }

    #[allow(clippy::missing_panics_doc)]
    pub fn get(&self, key: &K) -> Option<Holder<'_, K, V>> {
        self.get_internal(self.map.read().expect("cannot obtain lock").get(key))
    }

    fn get_internal(&self, v: Option<&Value<V>>) -> Option<Holder<'_, K, V>> {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…