Skip to content

map

Helpers for HashMap that the standard library does not provide.

Inputs are borrowed and results are new maps: nothing is mutated.

Cargo feature map (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features map

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.5", default-features = false, features = ["map"] }

Import path: helpers4::map.

ItemWhat it does
map_valuesReturns a new map with the same keys and each value replaced by f(value).
omitReturns a new map with the entries of map except those whose key is in keys.
pickReturns a new map with only the entries of map whose key is in keys.