Skip to main content

MapLike

Trait MapLike 

Source
pub trait MapLike {
    type Key: Hash + Eq + Display + Clone;
    type Value: Debug;

    // Required methods
    fn contains_key(&self, key: &Self::Key) -> bool;
    fn is_empty(&self) -> bool;
}
Expand description

Represents a generic map-like container with key-value pairs.

Required Associated Types§

Source

type Key: Hash + Eq + Display + Clone

The type of keys stored in the map.

Source

type Value: Debug

The type of values stored in the map.

Required Methods§

Source

fn contains_key(&self, key: &Self::Key) -> bool

Returns true if the map contains the specified key.

Source

fn is_empty(&self) -> bool

Returns true if the map is empty.

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, S> MapLike for AHashMap<K, V, S>
where K: Eq + Hash + Display + Clone, V: Debug, S: BuildHasher,

Source§

type Key = K

Source§

type Value = V

Source§

fn contains_key(&self, k: &K) -> bool

Source§

fn is_empty(&self) -> bool

Source§

impl<K, V, S> MapLike for HashMap<K, V, S>
where K: Eq + Hash + Display + Clone, V: Debug, S: BuildHasher,

Source§

type Key = K

Source§

type Value = V

Source§

fn contains_key(&self, k: &K) -> bool

Source§

fn is_empty(&self) -> bool

Source§

impl<K, V, S> MapLike for IndexMap<K, V, S>
where K: Eq + Hash + Display + Clone, V: Debug, S: BuildHasher,

Source§

type Key = K

Source§

type Value = V

Source§

fn contains_key(&self, k: &K) -> bool

Source§

fn is_empty(&self) -> bool

Implementors§