Trait Map

Source
pub trait Map {
    type K;
    type V;
    type VacantEntry<'a>: VacantEntry<'a, K = Self::K, V = Self::V>
       where Self: 'a;
    type OccupiedEntry<'a>: OccupiedEntry<'a, K = Self::K, V = Self::V>
       where Self: 'a;

    // Required methods
    fn contains_key(&self, k: &Self::K) -> bool;
    fn get(&self, k: &Self::K) -> Option<&Self::V>;
    fn get_mut(&mut self, k: &Self::K) -> Option<&mut Self::V>;
    fn insert(&mut self, k: Self::K, v: Self::V) -> Option<Self::V>;
    fn entry(
        &mut self,
        k: Self::K,
    ) -> Entry<Self::VacantEntry<'_>, Self::OccupiedEntry<'_>>;
    fn remove(&mut self, k: &Self::K) -> Option<Self::V>;
}

Required Associated Types§

Source

type K

Source

type V

Source

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

Source

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

Required Methods§

Source

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

Source

fn get(&self, k: &Self::K) -> Option<&Self::V>

Source

fn get_mut(&mut self, k: &Self::K) -> Option<&mut Self::V>

Source

fn insert(&mut self, k: Self::K, v: Self::V) -> Option<Self::V>

Source

fn entry( &mut self, k: Self::K, ) -> Entry<Self::VacantEntry<'_>, Self::OccupiedEntry<'_>>

Source

fn remove(&mut self, k: &Self::K) -> Option<Self::V>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<K, V> Map for BTreeMap<K, V>
where K: Ord,

Source§

type K = K

Source§

type V = V

Source§

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

Source§

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

Source§

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

Source§

fn get(&self, k: &Self::K) -> Option<&Self::V>

Source§

fn get_mut(&mut self, k: &Self::K) -> Option<&mut Self::V>

Source§

fn insert(&mut self, k: Self::K, v: Self::V) -> Option<Self::V>

Source§

fn entry( &mut self, k: Self::K, ) -> Entry<Self::VacantEntry<'_>, Self::OccupiedEntry<'_>>

Source§

fn remove(&mut self, k: &Self::K) -> Option<Self::V>

Source§

impl<K, V, H> Map for IterableMap<K, V, H>
where K: Ord + BorshSerialize + BorshDeserialize + Clone, V: BorshSerialize + BorshDeserialize, H: ToKey,

Source§

type K = K

Source§

type V = V

Source§

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

Source§

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

Source§

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

Source§

fn get(&self, k: &Self::K) -> Option<&Self::V>

Source§

fn get_mut(&mut self, k: &Self::K) -> Option<&mut Self::V>

Source§

fn insert(&mut self, k: Self::K, v: Self::V) -> Option<Self::V>

Source§

fn entry( &mut self, k: Self::K, ) -> Entry<Self::VacantEntry<'_>, Self::OccupiedEntry<'_>>

Source§

fn remove(&mut self, k: &Self::K) -> Option<Self::V>

Source§

impl<K, V, H> Map for LookupMap<K, V, H>
where K: Ord + BorshSerialize + Clone, V: BorshSerialize + BorshDeserialize, H: ToKey,

Source§

type K = K

Source§

type V = V

Source§

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

Source§

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

Source§

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

Source§

fn get(&self, k: &Self::K) -> Option<&Self::V>

Source§

fn get_mut(&mut self, k: &Self::K) -> Option<&mut Self::V>

Source§

fn insert(&mut self, k: Self::K, v: Self::V) -> Option<Self::V>

Source§

fn entry( &mut self, k: Self::K, ) -> Entry<Self::VacantEntry<'_>, Self::OccupiedEntry<'_>>

Source§

fn remove(&mut self, k: &Self::K) -> Option<Self::V>

Source§

impl<K, V, S> Map for HashMap<K, V, S>
where K: Eq + Hash, S: BuildHasher,

Source§

type K = K

Source§

type V = V

Source§

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

Source§

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

Source§

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

Source§

fn get(&self, k: &Self::K) -> Option<&Self::V>

Source§

fn get_mut(&mut self, k: &Self::K) -> Option<&mut Self::V>

Source§

fn insert(&mut self, k: Self::K, v: Self::V) -> Option<Self::V>

Source§

fn entry( &mut self, k: Self::K, ) -> Entry<Self::VacantEntry<'_>, Self::OccupiedEntry<'_>>

Source§

fn remove(&mut self, k: &Self::K) -> Option<Self::V>

Implementors§