Get

Trait Get 

Source
pub trait Get<T>: CollectionRef {
    // Required method
    fn get(&self, key: T) -> Option<Self::ItemRef<'_>>;

    // Provided method
    fn contains(&self, key: T) -> bool { ... }
}
Expand description

Queryable collection.

Required Methods§

Source

fn get(&self, key: T) -> Option<Self::ItemRef<'_>>

Returns a reference to the item stored behind the given key (if any).

Provided Methods§

Source

fn contains(&self, key: T) -> bool

Checks if the collection contains an item behind the given key.

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<'a, Q, K, V> Get<&'a Q> for BTreeMap<K, V>
where K: Borrow<Q> + Ord, Q: Ord + ?Sized,

Source§

fn get(&self, key: &'a Q) -> Option<&V>

Source§

impl<'a, Q, K, V> Get<&'a Q> for HashMap<K, V>
where K: Borrow<Q> + Hash + Eq, Q: Hash + Eq + ?Sized,

Source§

fn get(&self, key: &'a Q) -> Option<&V>

Source§

impl<'a, Q, T> Get<&'a Q> for BTreeSet<T>
where T: Borrow<Q> + Ord, Q: Ord + ?Sized,

Source§

fn get(&self, t: &'a Q) -> Option<&T>

Source§

impl<'a, Q, T> Get<&'a Q> for HashSet<T>
where T: Borrow<Q> + Hash + Eq, Q: Hash + Eq + ?Sized,

Source§

fn get(&self, value: &'a Q) -> Option<&T>

Source§

impl<T> Get<usize> for Vec<T>

Source§

fn get(&self, index: usize) -> Option<&T>

Implementors§