Skip to content

Commit 7138c5a

Browse files
authored
Merge pull request #7 from hmuendel/default
Default
2 parents f98dbf5 + b39f6b2 commit 7138c5a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ impl<K1: Eq + Hash + Debug, K2: Eq + Hash + Debug, V: Debug> fmt::Debug for Mult
249249
}
250250
}
251251

252+
impl<K1, K2, V> Default for MultiMap<K1, K2, V>
253+
where
254+
K1: Eq + Hash + Clone,
255+
K2: Eq + Hash + Clone,
256+
{
257+
/// Creates an empty `MultiMap<K1, K2, V>`
258+
#[inline]
259+
fn default() -> MultiMap<K1, K2, V> {
260+
MultiMap::new()
261+
}
262+
}
263+
252264
/// An iterator over the entries of a `MultiMap` like in a `HashMap` but with
253265
/// values of the form (K2, V) instead of V.
254266
///
@@ -336,6 +348,7 @@ impl<K1, K2, V> Iterator for IntoIter<K1, K2, V> {
336348
self.base.size_hint()
337349
}
338350
}
351+
339352
#[macro_export]
340353
/// Create a `MultiMap` from a list of key-value tuples
341354
///

0 commit comments

Comments
 (0)