Skip to main content

PreventDuplicateInsertsMap

Trait PreventDuplicateInsertsMap 

Source
pub trait PreventDuplicateInsertsMap<K, V> {
    // Required methods
    fn new(size_hint: Option<usize>) -> Self;
    fn insert(&mut self, key: K, value: V) -> bool;
}

Required Methods§

Source

fn new(size_hint: Option<usize>) -> Self

Source

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

Return true if the insert was successful and the key did not exist in 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.

Implementors§

Source§

impl<K, V> PreventDuplicateInsertsMap<K, V> for BTreeMap<K, V>
where K: Ord,

Source§

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

Available on crate feature std only.