Struct starlark::collections::small_map::SmallMap [−][src]
#[repr(C)]pub struct SmallMap<K, V> { /* fields omitted */ }
Expand description
An memory-efficient key-value map with determinstic order.
Provides the standard container operations, modelled most closely on IndexMap
, plus:
-
Variants which take an already hashed value, e.g.
get_hashed
. -
Functions which work with the position, e.g.
get_index_of
.
Implementations
pub fn get_hashed<Q>(&self, key: BorrowHashed<'_, Q>) -> Option<&V> where
Q: Equivalent<K> + ?Sized,
K: Eq,
pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)> where
Q: Hash + Equivalent<K> + ?Sized,
K: Eq,
pub fn get_index_of_hashed<Q>(&self, key: BorrowHashed<'_, Q>) -> Option<usize> where
Q: Equivalent<K> + ?Sized,
K: Eq,
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize> where
Q: Hash + Equivalent<K> + ?Sized,
K: Eq,
pub fn get_mut_hashed<Q>(&mut self, key: BorrowHashed<'_, Q>) -> Option<&mut V> where
Q: Equivalent<K> + ?Sized,
K: Eq,
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V> where
Q: Hash + Equivalent<K> + ?Sized,
K: Eq,
pub fn contains_key_hashed<Q>(&self, key: BorrowHashed<'_, Q>) -> bool where
Q: Equivalent<K> + ?Sized,
K: Eq,
pub fn remove_hashed<Q>(&mut self, key: BorrowHashed<'_, Q>) -> Option<V> where
Q: ?Sized + Equivalent<K>,
K: Eq,
pub fn remove_hashed_entry<Q>(
&mut self,
key: BorrowHashed<'_, Q>
) -> Option<(K, V)> where
Q: ?Sized + Equivalent<K>,
K: Eq,
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)> where
Q: ?Sized + Hash + Equivalent<K>,
K: Eq,
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<'v, K: UnpackValue<'v> + Hash + Eq, V: UnpackValue<'v>> UnpackValue<'v> for SmallMap<K, V>
impl<'v, K: UnpackValue<'v> + Hash + Eq, V: UnpackValue<'v>> UnpackValue<'v> for SmallMap<K, V>
Unpack value, but instead of None
return error about incorrect argument type.
Unpack value, but instead of None
return error about incorrect named argument type.
Auto Trait Implementations
impl<K, V> RefUnwindSafe for SmallMap<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> UnwindSafe for SmallMap<K, V> where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.