values

Function values 

Source
pub fn values<K, V>(maps: &[&HashMap<K, V>]) -> Vec<V>
where V: Clone,
Expand description

Collects all values from one or more maps into a single vector.

Iterates over each map and collects all values into a single vector.

§Arguments

  • maps - A slice of references to maps to collect values from

§Returns

  • Vec<V> - A vector containing all values from the input maps

§Examples

use lowdash::values;
use std::collections::HashMap;

let mut map1 = HashMap::new();
map1.insert("a", 1);
map1.insert("b", 2);

let mut map2 = HashMap::new();
map2.insert("c", 3);
map2.insert("d", 4);

let result = values(&[&map1, &map2]);
assert_eq!(result.len(), 4);
assert!(result.contains(&1));
assert!(result.contains(&2));
assert!(result.contains(&3));
assert!(result.contains(&4));