Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,17 @@ pub struct LruCache<K, V, S = DefaultHasher> {
tail: *mut LruEntry<K, V>,
}

impl<K, V> Clone for LruCache<K, V>
impl<K, V, S> Clone for LruCache<K, V, S>
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());
Expand Down
Loading