1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use indexmap::IndexSet;

use std::collections::HashMap;

/// Update a IndexSet "a" with the values from "b"
#[inline]
pub(crate) fn append_indexset<T>(a: &mut IndexSet<T>, b: &IndexSet<T>)
where
    T: Clone + Eq + Ord + std::hash::Hash,
{
    for value in b {
        a.insert(value.clone());
    }
}

/// Update a Hashmap "a" with the values from "b".
#[inline]
pub(crate) fn append_hashmap<K, V>(a: &mut HashMap<K, V>, b: &HashMap<K, V>)
where
    K: Clone + Eq + Ord + std::hash::Hash,
    V: Clone,
{
    for (key, value) in b {
        a.insert(key.clone(), value.clone());
    }
}