pub struct SmallOrderedMap<Key, Value>(/* private fields */);Expand description
A mapping optimized for very small maps.
Wrapping the vector_map::VecMap structure.
Implementations§
Source§impl<Key: Eq, Value> SmallOrderedMap<Key, Value>
impl<Key: Eq, Value> SmallOrderedMap<Key, Value>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new map with the given capacity.
Source§impl<Key: Eq, Value: Eq> SmallOrderedMap<Key, Value>
impl<Key: Eq, Value: Eq> SmallOrderedMap<Key, Value>
Sourcepub fn eq_unordered(&self, other: &Self) -> bool
pub fn eq_unordered(&self, other: &Self) -> bool
Checks if the two maps have the same keys and values.
Methods from Deref<Target = VecMap<Key, Value>>§
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
pub fn clear(&mut self)
pub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn get<'l, Q>(&'l self, key: &Q) -> Option<&'l V>
pub fn get_mut<'l, Q>(&'l mut self, key: &Q) -> Option<&'l mut V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>where
K: PartialEq,
pub fn drain(&mut self) -> Drain<'_, K, V>
pub fn reserve(&mut self, additional: usize)
pub fn shrink_to_fit(&mut self)
pub fn get_key_value<'l, Q>(&'l self, key: &Q) -> Option<(&'l K, &'l V)>
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>where
K: PartialEq,
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
pub fn retain<F>(&mut self, f: F)
pub fn iter(&self) -> Iter<'_, K, V>
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>
pub fn sort(&mut self)where
K: Ord,
Sourcepub unsafe fn identical(&self, other: &VecMap<K, V>) -> bool
pub unsafe fn identical(&self, other: &VecMap<K, V>) -> bool
Much faster than self == other, but will return false if the order of the data isn’t identical.
§Safety
Note that for the order of data with two VecMaps to be identical, they must either have been both sorted,
or they must have undergone the insertion and removal of keys in the same order.
pub fn keys(&self) -> Keys<'_, K, V>
pub fn values(&self) -> Values<'_, K, V>
Trait Implementations§
Source§impl<Key: Clone, Value: Clone> Clone for SmallOrderedMap<Key, Value>
impl<Key: Clone, Value: Clone> Clone for SmallOrderedMap<Key, Value>
Source§fn clone(&self) -> SmallOrderedMap<Key, Value>
fn clone(&self) -> SmallOrderedMap<Key, Value>
Returns a duplicate 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<Key: Eq, Value> Default for SmallOrderedMap<Key, Value>
impl<Key: Eq, Value> Default for SmallOrderedMap<Key, Value>
Source§impl<Key, Value> Deref for SmallOrderedMap<Key, Value>
impl<Key, Value> Deref for SmallOrderedMap<Key, Value>
Source§impl<Key, Value> DerefMut for SmallOrderedMap<Key, Value>
impl<Key, Value> DerefMut for SmallOrderedMap<Key, Value>
Source§impl<Key: Eq, Value> FromIterator<(Key, Value)> for SmallOrderedMap<Key, Value>
impl<Key: Eq, Value> FromIterator<(Key, Value)> for SmallOrderedMap<Key, Value>
Source§fn from_iter<T: IntoIterator<Item = (Key, Value)>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = (Key, Value)>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl<Key, Value> IntoIterator for SmallOrderedMap<Key, Value>
impl<Key, Value> IntoIterator for SmallOrderedMap<Key, Value>
Source§impl<Key: Eq, Value: HasZero + Clone + Eq> MergeCollection<Key, Value> for SmallOrderedMap<Key, Value>
Available on crate feature std only.
impl<Key: Eq, Value: HasZero + Clone + Eq> MergeCollection<Key, Value> for SmallOrderedMap<Key, Value>
Available on crate feature
std only.Source§fn merge_collection(
self,
other: impl IntoIterator<Item = (Key, Value)>,
action: impl Fn(Value, Value) -> Value,
) -> Self
fn merge_collection( self, other: impl IntoIterator<Item = (Key, Value)>, action: impl Fn(Value, Value) -> Value, ) -> Self
Returns a collection which contains the combination by using
action of the values from the
given two collections, for each key. Read moreSource§impl<Key: Update + Eq, Value: Update> Update for SmallOrderedMap<Key, Value>
Available on crate feature salsa only.
impl<Key: Update + Eq, Value: Update> Update for SmallOrderedMap<Key, Value>
Available on crate feature
salsa only.impl<Key: Eq, Value: Eq> Eq for SmallOrderedMap<Key, Value>
Auto Trait Implementations§
impl<Key, Value> Freeze for SmallOrderedMap<Key, Value>
impl<Key, Value> RefUnwindSafe for SmallOrderedMap<Key, Value>where
Key: RefUnwindSafe,
Value: RefUnwindSafe,
impl<Key, Value> Send for SmallOrderedMap<Key, Value>
impl<Key, Value> Sync for SmallOrderedMap<Key, Value>
impl<Key, Value> Unpin for SmallOrderedMap<Key, Value>
impl<Key, Value> UnwindSafe for SmallOrderedMap<Key, Value>where
Key: UnwindSafe,
Value: UnwindSafe,
Blanket Implementations§
Source§impl<Key, Value, T> AddCollection<Key, Value> for Twhere
Value: Add<Output = Value>,
T: MergeCollection<Key, Value>,
impl<Key, Value, T> AddCollection<Key, Value> for Twhere
Value: Add<Output = Value>,
T: MergeCollection<Key, Value>,
Source§fn add_collection(self, other: impl IntoIterator<Item = (Key, Value)>) -> T
fn add_collection(self, other: impl IntoIterator<Item = (Key, Value)>) -> T
Returns a new collection with the sum of the values from the given two collections, for each
key. Read more
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<Key, Value, T> SubCollection<Key, Value> for Twhere
Value: Sub<Output = Value>,
T: MergeCollection<Key, Value>,
impl<Key, Value, T> SubCollection<Key, Value> for Twhere
Value: Sub<Output = Value>,
T: MergeCollection<Key, Value>,
Source§fn sub_collection(self, other: impl IntoIterator<Item = (Key, Value)>) -> T
fn sub_collection(self, other: impl IntoIterator<Item = (Key, Value)>) -> T
Returns a new collection with the difference of the values from the given two collections,
for each key. Read more