pub fn map_to_slice<K, V, R, F>(map: &HashMap<K, V>, iteratee: F) -> Vec<R>Expand description
Transforms the entries of a map into a slice using a provided function.
§Arguments
map- The input map whose entries are to be transformed.iteratee- A function that takes a reference to a key and its value, returning a new value.
§Returns
Vec<R>- A vector containing the transformed values.
§Examples
use lowdash::map_to_slice;
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert("a", 1);
map.insert("b", 2);
let transformed = map_to_slice(&map, |k, v| format!("{}:{}", k, v));
assert!(transformed.contains(&"a:1".to_string()));
assert!(transformed.contains(&"b:2".to_string()));