Skip to main content

Map

Trait Map 

Source
pub trait Map<K, V> {
    // Required method
    fn insert(&mut self, key: K, value: V);
}
Expand description

A trait for “map” types (such as HashMap) that you can collect into with an AggregateMap.

Implementations of this trait are provided for std maps, but if you have a custom map type you can implement this trait for it to be able to use it with AggregateMap.

Implementors of this trait will generally have a key of K, but a value of some collection type (like Vec or HashSet), which contains multiple values of type V.

Required Methods§

Source

fn insert(&mut self, key: K, value: V)

Insert one value into the collection contained at key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<K, V, C, S> Map<K, V> for HashMap<K, C, S>
where K: Eq + Hash, C: Default + Extend<V>, S: BuildHasher,

Available on crate feature hashmap only.
Source§

fn insert(&mut self, key: K, value: V)

Source§

impl<K, V, C> Map<K, V> for BTreeMap<K, C>
where K: Eq + Ord + Hash, C: Default + Extend<V>,

Available on crate feature btreemap only.
Source§

fn insert(&mut self, key: K, value: V)

Implementors§