Struct starlark_map::ordered_map::OrderedMap
source · pub struct OrderedMap<K, V>(/* private fields */);
Expand description
Wrapper for SmallMap
which considers map equal if iteration order is equal.
Implementations§
source§impl<K, V> OrderedMap<K, V>
impl<K, V> OrderedMap<K, V>
sourcepub const fn new() -> OrderedMap<K, V>
pub const fn new() -> OrderedMap<K, V>
Create a new empty map.
sourcepub fn with_capacity(capacity: usize) -> OrderedMap<K, V>
pub fn with_capacity(capacity: usize) -> OrderedMap<K, V>
Create a new empty map with the specified capacity.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
Iterate over the entries, with mutable values.
sourcepub fn keys(&self) -> impl ExactSizeIterator<Item = &K>
pub fn keys(&self) -> impl ExactSizeIterator<Item = &K>
Iterate over the keys.
sourcepub fn values(&self) -> impl ExactSizeIterator<Item = &V>
pub fn values(&self) -> impl ExactSizeIterator<Item = &V>
Iterate over the values.
sourcepub fn values_mut(&mut self) -> impl ExactSizeIterator<Item = &mut V>
pub fn values_mut(&mut self) -> impl ExactSizeIterator<Item = &mut V>
Iterate over the values, with mutable values.
sourcepub fn get<'a, Q>(&'a self, k: &Q) -> Option<&'a V>
pub fn get<'a, Q>(&'a self, k: &Q) -> Option<&'a V>
Get a reference to the value associated with the given key.
sourcepub fn get_mut<'a, Q>(&'a mut self, k: &Q) -> Option<&'a mut V>
pub fn get_mut<'a, Q>(&'a mut self, k: &Q) -> Option<&'a mut V>
Get a mutable reference to the value associated with the given key.
sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
Find an entry index for a given key.
sourcepub fn contains_key<Q>(&self, k: &Q) -> bool
pub fn contains_key<Q>(&self, k: &Q) -> bool
Check if the map contains the given key.
sourcepub fn iter_hashed(&self) -> IterHashed<'_, K, V> ⓘ
pub fn iter_hashed(&self) -> IterHashed<'_, K, V> ⓘ
Iterate over the map with hashes.
Trait Implementations§
source§impl<K: Allocative, V: Allocative> Allocative for OrderedMap<K, V>
impl<K: Allocative, V: Allocative> Allocative for OrderedMap<K, V>
source§impl<K: Clone, V: Clone> Clone for OrderedMap<K, V>
impl<K: Clone, V: Clone> Clone for OrderedMap<K, V>
source§fn clone(&self) -> OrderedMap<K, V>
fn clone(&self) -> OrderedMap<K, V>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<K, V> Default for OrderedMap<K, V>
impl<K, V> Default for OrderedMap<K, V>
source§fn default() -> OrderedMap<K, V>
fn default() -> OrderedMap<K, V>
Returns the “default value” for a type. Read more
source§impl<'de, K, V> Deserialize<'de> for OrderedMap<K, V>
impl<'de, K, V> Deserialize<'de> for OrderedMap<K, V>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<K, V> Extend<(K, V)> for OrderedMap<K, V>
impl<K, V> Extend<(K, V)> for OrderedMap<K, V>
source§fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<K: Ord + Hash, V> From<OrderedMap<K, V>> for SortedMap<K, V>
impl<K: Ord + Hash, V> From<OrderedMap<K, V>> for SortedMap<K, V>
source§fn from(map: OrderedMap<K, V>) -> SortedMap<K, V>
fn from(map: OrderedMap<K, V>) -> SortedMap<K, V>
Converts to this type from the input type.
source§impl<K, V> From<SmallMap<K, V>> for OrderedMap<K, V>
impl<K, V> From<SmallMap<K, V>> for OrderedMap<K, V>
source§fn from(map: SmallMap<K, V>) -> OrderedMap<K, V>
fn from(map: SmallMap<K, V>) -> OrderedMap<K, V>
Converts to this type from the input type.
source§impl<K, V> FromIterator<(K, V)> for OrderedMap<K, V>
impl<K, V> FromIterator<(K, V)> for OrderedMap<K, V>
source§fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> OrderedMap<K, V>
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> OrderedMap<K, V>
Creates a value from an iterator. Read more
source§impl<'a, K, V> IntoIterator for &'a OrderedMap<K, V>
impl<'a, K, V> IntoIterator for &'a OrderedMap<K, V>
source§impl<'a, K, V> IntoIterator for &'a mut OrderedMap<K, V>
impl<'a, K, V> IntoIterator for &'a mut OrderedMap<K, V>
source§impl<K, V> IntoIterator for OrderedMap<K, V>
impl<K, V> IntoIterator for OrderedMap<K, V>
source§impl<K: Eq + Ord, V: Eq + Ord> Ord for OrderedMap<K, V>
impl<K: Eq + Ord, V: Eq + Ord> Ord for OrderedMap<K, V>
source§impl<K: PartialEq, V: PartialEq> PartialEq for OrderedMap<K, V>
impl<K: PartialEq, V: PartialEq> PartialEq for OrderedMap<K, V>
source§impl<K: PartialOrd, V: PartialOrd> PartialOrd for OrderedMap<K, V>
impl<K: PartialOrd, V: PartialOrd> PartialOrd for OrderedMap<K, V>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<K: Eq, V: Eq> Eq for OrderedMap<K, V>
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for OrderedMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for OrderedMap<K, V>
impl<K, V> Sync for OrderedMap<K, V>
impl<K, V> Unpin for OrderedMap<K, V>
impl<K, V> UnwindSafe for OrderedMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.