Skip to main content

MapCollection

Trait MapCollection 

Source
pub trait MapCollection {
    type Key;
    type Value;
    type Iter<'a>: Iterator<Item = (&'a Self::Key, &'a Self::Value)> + 'a
       where Self: 'a;

    // Required methods
    fn iter(&self) -> Self::Iter<'_>;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Explicit iteration contract for generated map wrapper types.

Required Associated Types§

Source

type Key

Key type exposed by the map.

Source

type Value

Value type exposed by the map.

Source

type Iter<'a>: Iterator<Item = (&'a Self::Key, &'a Self::Value)> + 'a where Self: 'a

Iterator tied to the borrow of this map.

Required Methods§

Source

fn iter(&self) -> Self::Iter<'_>

Iterate over the map’s entries.

Source

fn len(&self) -> usize

Return the number of entries in the map.

Provided Methods§

Source

fn is_empty(&self) -> bool

Return whether the map contains no entries.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<K, V> MapCollection for BTreeMap<K, V>

Source§

type Key = K

Source§

type Value = V

Source§

type Iter<'a> = Iter<'a, K, V> where Self: 'a

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

fn len(&self) -> usize

Implementors§