Skip to content

Commit c79f016

Browse files
committed
Implement Extend<(&K, &V)> where K: Copy, V: Copy
Closes #33.
1 parent a37077a commit c79f016

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,16 @@ impl<K: Hash + Eq, V, S: BuildHasher> Extend<(K, V)> for LinkedHashMap<K, V, S>
640640
}
641641
}
642642

643+
impl<'a, K, V, S> Extend<(&'a K, &'a V)> for LinkedHashMap<K, V, S>
644+
where K: 'a + Hash + Eq + Copy, V: 'a + Copy, S: BuildHasher,
645+
{
646+
fn extend<I: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: I) {
647+
for (&k, &v) in iter {
648+
self.insert(k, v);
649+
}
650+
}
651+
}
652+
643653
impl<K: Hash + Eq, V, S: BuildHasher + Default> iter::FromIterator<(K, V)> for LinkedHashMap<K, V, S> {
644654
fn from_iter<I: IntoIterator<Item=(K, V)>>(iter: I) -> Self {
645655
let iter = iter.into_iter();

0 commit comments

Comments
 (0)