Skip to main content

MapCollection

Trait MapCollection 

Source
pub trait MapCollection {
    type Key;
    type Value;

    // Required methods
    fn iter<'a>(
        &'a self,
    ) -> Box<dyn Iterator<Item = (&'a Self::Key, &'a Self::Value)> + 'a>;
    fn len(&self) -> usize;

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

Explicit iteration contract for map wrapper types. Avoids implicit deref-based access to inner collections.

Required Associated Types§

Required Methods§

Source

fn iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = (&'a Self::Key, &'a Self::Value)> + 'a>

Returns an iterator over the map’s key/value pairs.

Source

fn len(&self) -> usize

Returns the number of entries in the map.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the map contains no entries.

Implementors§