From a11f16739f08ec480263ba549d510fffc8ce557e Mon Sep 17 00:00:00 2001 From: gamazeps Date: Sat, 8 Nov 2014 01:40:20 +0100 Subject: Implements Extend for EnumSet and LruCache Part of #18424 --- src/libstd/collections/lru_cache.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/collections/lru_cache.rs b/src/libstd/collections/lru_cache.rs index aab0924e7e4..94bea37d187 100644 --- a/src/libstd/collections/lru_cache.rs +++ b/src/libstd/collections/lru_cache.rs @@ -41,7 +41,7 @@ use cmp::{PartialEq, Eq}; use collections::HashMap; use fmt; use hash::Hash; -use iter::{range, Iterator}; +use iter::{range, Iterator, Extend}; use mem; use ops::Drop; use option::{Some, None, Option}; @@ -329,6 +329,15 @@ impl LruCache { /// Clear the cache of all key-value pairs. #[unstable = "matches collection reform specification, waiting for dust to settle"] pub fn clear(&mut self) { self.map.clear(); } + +} + +impl Extend<(K, V)> for LruCache { + fn extend>(&mut self, mut iter: T) { + for (k, v) in iter{ + self.insert(k, v); + } + } } impl fmt::Show for LruCache { -- cgit 1.4.1-3-g733a5