diff --git a/src/lib.rs b/src/lib.rs index 8fe7be4..aeaa9ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -193,13 +193,17 @@ pub struct LruCache { tail: *mut LruEntry, } -impl Clone for LruCache +impl Clone for LruCache where K: Hash + PartialEq + Eq + Clone, V: Clone, + S: BuildHasher + Clone, { fn clone(&self) -> Self { - let mut new_lru = LruCache::new(self.cap()); + let mut new_lru = LruCache::construct( + self.cap(), + HashMap::with_capacity_and_hasher(self.cap().get(), self.map.hasher().clone()), + ); for (key, value) in self.iter().rev() { new_lru.push(key.clone(), value.clone());