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

Iteration contract for generated map wrappers.

Required Associated Types§

Source

type Key

Key type.

Source

type Value

Value type.

Source

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

Borrowed iterator type.

Required Methods§

Source

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

Iterate over entries.

Source

fn len(&self) -> usize

Return the number of entries.

Provided Methods§

Source

fn is_empty(&self) -> bool

Return whether this map is empty.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl MapCollection for Map

Source§

type Key = String

Source§

type Value = Value

Source§

type Iter<'a> = Iter<'a, String, Value> where Self: 'a