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