mirror of https://github.com/MingweiSamuel/Riven
style: cleanup `insert_only_chashmap.rs` (#63)
parent
092ea34358
commit
4faa8e83e4
|
@ -1,4 +1,3 @@
|
||||||
// use std::borrow::Borrow;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -17,15 +16,6 @@ impl<K: Hash + Eq, V> InsertOnlyCHashMap<K, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[inline]
|
|
||||||
// pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<Arc<V>>
|
|
||||||
// where
|
|
||||||
// K: Borrow<Q>,
|
|
||||||
// Q: Hash + Eq,
|
|
||||||
// {
|
|
||||||
// self.base.lock().get(key).map(|v| Arc::clone(v))
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_or_insert_with<F: FnOnce() -> V>(&self, key: K, default: F) -> Arc<V> {
|
pub fn get_or_insert_with<F: FnOnce() -> V>(&self, key: K, default: F) -> Arc<V> {
|
||||||
Arc::clone(
|
Arc::clone(
|
||||||
|
|
Loading…
Reference in New Issue