pub trait MapMapValues<OldVal> {
    type MapValue<NewVal>;

    // Required method
    fn map_values<NewVal, MapFn>(self, map_fn: MapFn) -> Self::MapValue<NewVal>
       where MapFn: FnMut(OldVal) -> NewVal;
}
Expand description

Trait for transforming the values of a map without changing the overall type of the data structure.

Required Associated Types§

source

type MapValue<NewVal>

Output type, should be Self but with OldVal replaced with NewVal.

Required Methods§

source

fn map_values<NewVal, MapFn>(self, map_fn: MapFn) -> Self::MapValue<NewVal>
where MapFn: FnMut(OldVal) -> NewVal,

Map the values into using the map_fn.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<Key, OldVal> MapMapValues<OldVal> for BTreeMap<Key, OldVal>
where Key: Eq + Ord,

§

type MapValue<NewVal> = BTreeMap<Key, NewVal>

source§

fn map_values<NewVal, MapFn>(self, map_fn: MapFn) -> Self::MapValue<NewVal>
where MapFn: FnMut(OldVal) -> NewVal,

source§

impl<Key, OldVal> MapMapValues<OldVal> for HashMap<Key, OldVal>
where Key: Eq + Hash,

§

type MapValue<NewVal> = HashMap<Key, NewVal>

source§

fn map_values<NewVal, MapFn>(self, map_fn: MapFn) -> Self::MapValue<NewVal>
where MapFn: FnMut(OldVal) -> NewVal,

Implementors§

source§

impl<K, OldVal> MapMapValues<OldVal> for OptionMap<K, OldVal>

§

type MapValue<NewVal> = OptionMap<K, NewVal>

source§

impl<K, OldVal> MapMapValues<OldVal> for SingletonMap<K, OldVal>

§

type MapValue<NewVal> = SingletonMap<K, NewVal>

source§

impl<K, OldVal> MapMapValues<OldVal> for VecMap<K, OldVal>

§

type MapValue<NewVal> = VecMap<K, NewVal>

source§

impl<K, OldVal, const N: usize> MapMapValues<OldVal> for ArrayMap<K, OldVal, N>

§

type MapValue<NewVal> = ArrayMap<K, NewVal, N>