Skip to main content

MapContainer

Trait MapContainer 

Source
pub trait MapContainer: Sync {
    type Key;
    type Value;

    // Required methods
    fn get(&self, index: usize) -> Option<(&Self::Key, &Self::Value)>;
    fn len(&self) -> usize;
}
Expand description

a random-access container containing pairs of keys and values.

Both a tuple of two Containers and a Container of tuples are considered MapContainers: Examples are (Vec<Key>, &[Val]) and Box<[(Key, Val)]>.

Required Associated Types§

Required Methods§

Source

fn get(&self, index: usize) -> Option<(&Self::Key, &Self::Value)>

Source

fn len(&self) -> usize

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> MapContainer for (K, V)
where K: Container, V: Container,

Source§

type Key = <K as Container>::Item

Source§

type Value = <V as Container>::Item

Source§

fn get(&self, index: usize) -> Option<(&Self::Key, &Self::Value)>

Source§

fn len(&self) -> usize

Implementors§

Source§

impl<T, K, V> MapContainer for T
where T: Container<Item = (K, V)>,

Source§

type Key = K

Source§

type Value = V