Keyed

Trait Keyed 

Source
pub trait Keyed {
    type Key;
    type Value;

    // Required methods
    fn different_keys<'l>(
        &'l self,
        other: &'l Self,
    ) -> SmallVec<[&'l Self::Key; 2]>;
    fn get(&self, key: &Self::Key) -> Option<&Self::Value>;

    // Provided method
    fn contains_key(&self, key: &Self::Key) -> bool { ... }
}

Required Associated Types§

Required Methods§

Source

fn different_keys<'l>(&'l self, other: &'l Self) -> SmallVec<[&'l Self::Key; 2]>

Source

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

Provided Methods§

Source

fn contains_key(&self, key: &Self::Key) -> bool

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: Eq + Hash, H: BuildHasher> Keyed for HashSet<K, H>

Source§

type Key = K

Source§

type Value = ()

Source§

fn different_keys<'l>(&'l self, other: &'l Self) -> SmallVec<[&'l Self::Key; 2]>

Source§

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

Source§

fn contains_key(&self, key: &Self::Key) -> bool

Source§

impl<K: Eq + Hash, H: BuildHasher> Keyed for IndexSet<K, H>

Source§

type Key = K

Source§

type Value = ()

Source§

fn different_keys<'l>(&'l self, other: &'l Self) -> SmallVec<[&'l Self::Key; 2]>

Source§

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

Source§

fn contains_key(&self, key: &Self::Key) -> bool

Source§

impl<K: Eq + Hash, V: PartialEq, H: BuildHasher> Keyed for HashMap<K, V, H>

Source§

type Key = K

Source§

type Value = V

Source§

fn different_keys<'l>(&'l self, other: &'l Self) -> SmallVec<[&'l Self::Key; 2]>

Source§

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

Source§

fn contains_key(&self, key: &Self::Key) -> bool

Source§

impl<K: Eq + Hash, V: PartialEq, H: BuildHasher> Keyed for IndexMap<K, V, H>

Source§

type Key = K

Source§

type Value = V

Source§

fn different_keys<'l>(&'l self, other: &'l Self) -> SmallVec<[&'l Self::Key; 2]>

Source§

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

Source§

fn contains_key(&self, key: &Self::Key) -> bool

Implementors§