Function hashmap_union::union_of

source ·
pub fn union_of<K, V, F>(
    one: &HashMap<K, V>,
    two: &HashMap<K, V>,
    f: F
) -> HashMap<K, V>
where K: Hash + Eq + Clone, V: Clone, F: Fn(V, V) -> V,
Expand description

Merges two hashmaps, using f where the keys exist in both hashmaps

  • one: The first hashmap
  • two: The second hashmap
  • f: What to do when the key exists in both hashmaps
  • Returns: The union of one and two