map_values
Returns a new map with the same keys and each value replaced by f(value).
Import
Section titled “Import”Cargo feature map (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
map | &HashMap<K, V, S> | The map to transform. |
f | impl FnMut(&V) -> W | Computes the new value from each old value. |
Returns
Section titled “Returns”HashMap<K, W>
