Trait MapMapValues

Source
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

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

Source§

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,

Source§

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>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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