Map1Plus

Trait Map1Plus 

Source
pub trait Map1Plus<BypassOrphanRule, K, V> {
    // Required methods
    fn from_1(key: K, value: V, capacity: usize) -> Self;
    fn insert(&mut self, key: K, value: V) -> Option<V>;
}
Expand description

Map that can have 1 or more elements. Unlocks: map! { a => b }

Required Methods§

Source

fn from_1(key: K, value: V, capacity: usize) -> Self

Create a map with the first key => value pair and the specified capacity

Not all sequences support capacity, so it may be ignored

Source

fn insert(&mut self, key: K, value: V) -> Option<V>

Insert a key => value pair into the map

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<K: Ord, V> Map1Plus<(), K, V> for BTreeMap<K, V>

Source§

fn from_1(first_key: K, first_value: V, _capacity: usize) -> Self

Source§

fn insert(&mut self, key: K, value: V) -> Option<V>

Source§

impl<K: Hash + Eq, V, S: Default + BuildHasher> Map1Plus<(), K, V> for HashMap<K, V, S>

Source§

fn from_1(first_key: K, first_value: V, capacity: usize) -> Self

Source§

fn insert(&mut self, key: K, value: V) -> Option<V>

Implementors§