aggregate_map/hashmap.rs
1//! Implementation of [`Map`] for a [`HashMap`].
2use std::collections::HashMap;
3
4use crate::Map;
5
6impl<K, V, C, S> Map<K, V> for HashMap<K, C, S>
7where
8 K: Eq + std::hash::Hash,
9 C: Default + Extend<V>,
10 S: std::hash::BuildHasher,
11{
12 fn insert(&mut self, key: K, value: V) {
13 self.entry(key).or_default().extend(std::iter::once(value));
14 }
15}