Struct serde_amqp::primitives::OrderedMap
source · pub struct OrderedMap<K, V>(/* private fields */);
Expand description
A wrapper around IndexMap
with custom implementation of PartialEq
, Eq
,
PartialOrd
, Ord
, Hash
, Serialize
, and Deserialize
.
Only a selected list of methods are re-exported for convenience.
Implementations§
source§impl<K, V> OrderedMap<K, V>
impl<K, V> OrderedMap<K, V>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new OrderedMap
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the number of key-value pairs in the map.
Calls IndexMap::len
internally
sourcepub fn iter(&self) -> Iter<'_, K, V> ⓘ
pub fn iter(&self) -> Iter<'_, K, V> ⓘ
Return an iterator over the key-value pairs of the map, in their order
Calls IndexMap::iter
internally
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
Return an iterator over the key-value pairs of the map, in their order
Calls IndexMap::iter_mut
internally
sourcepub fn as_inner(&self) -> &IndexMap<K, V>
pub fn as_inner(&self) -> &IndexMap<K, V>
Get a reference to the inner IndexMap
It is intentional to NOT implement the AsRef<IndexMap>
trait to avoid potential
misuse
sourcepub fn as_inner_mut(&mut self) -> &mut IndexMap<K, V>
pub fn as_inner_mut(&mut self) -> &mut IndexMap<K, V>
Get a mutable reference to the inner IndexMap
It is intentional to NOT implement the AsMut<IndexMap>
trait to avoid potential
misuse
sourcepub fn into_inner(self) -> IndexMap<K, V>
pub fn into_inner(self) -> IndexMap<K, V>
Consumes the wrapper and returns the inner IndexMap
sourcepub fn into_keys(self) -> IntoKeys<K, V> ⓘ
pub fn into_keys(self) -> IntoKeys<K, V> ⓘ
Return an owning iterator over the keys of the map, in their order
sourcepub fn keys(&self) -> Keys<'_, K, V> ⓘ
pub fn keys(&self) -> Keys<'_, K, V> ⓘ
Return an iterator over the keys of the map, in their order
sourcepub fn values(&self) -> Values<'_, K, V> ⓘ
pub fn values(&self) -> Values<'_, K, V> ⓘ
Return an iterator over the values of the map, in their order
sourcepub fn values_mut(&mut self) -> ValuesMut<'_, K, V> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> ⓘ
Return an iterator over mutable references to the values of the map, in their order
sourcepub fn into_values(self) -> IntoValues<K, V> ⓘ
pub fn into_values(self) -> IntoValues<K, V> ⓘ
Return an owning iterator over the values of the map, in their order
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Remove all key-value pairs in the map, while preserving its capacity.
Computes in O(n) time.
sourcepub fn drain<R>(&mut self, range: R) -> Drain<'_, K, V> ⓘwhere
R: RangeBounds<usize>,
pub fn drain<R>(&mut self, range: R) -> Drain<'_, K, V> ⓘwhere
R: RangeBounds<usize>,
Clears the IndexMap in the given index range, returning those key-value pairs as a drain iterator.
The range may be any type that implements RangeBounds<usize>
, including all of the std::ops::Range* types, or even a tuple pair of Bound start and end values. To drain the map entirely, use RangeFull like map.drain(..).
This shifts down all entries following the drained range to fill the gap, and keeps the allocated memory for reuse.
Panics if the starting point is greater than the end point or if the end point is greater than the length of the map.
source§impl<K, V> OrderedMap<K, V>
impl<K, V> OrderedMap<K, V>
sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Insert a key-value pair in the map.
Calls IndexMap::insert
internally
sourcepub fn swap_remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn swap_remove<Q>(&mut self, key: &Q) -> Option<V>
Calls IndexMap::swap_remove
internally
sourcepub fn shift_remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn shift_remove<Q>(&mut self, key: &Q) -> Option<V>
Calls IndexMap::shift_remove
internally
sourcepub fn swap_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
pub fn swap_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
Calls IndexMap::swap_remove_entry
internally
sourcepub fn shift_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
pub fn shift_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
Calls IndexMap::shift_remove_entry
internally
sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Return true if an equivalent to key exists in the map.
Calls IndexMap::contains_key
internally
sourcepub fn with_capacity(n: usize) -> Self
pub fn with_capacity(n: usize) -> Self
Create a new map with capacity for n key-value pairs. (Does not allocate if n is zero.)
Calls IndexMap::with_capacity
internally
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrink the capacity of the map as much as possible.
Calss IndexMap::shrink_to_fit
internally
Trait Implementations§
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>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<K: Default, V: Default> Default for OrderedMap<K, V>
impl<K: Default, V: Default> Default for OrderedMap<K, V>
source§fn default() -> OrderedMap<K, V>
fn default() -> OrderedMap<K, V>
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>,
source§impl<K, V> From<IndexMap<K, V>> for OrderedMap<K, V>
impl<K, V> From<IndexMap<K, V>> for OrderedMap<K, V>
source§impl<K, V> From<OrderedMap<K, V>> for Value
impl<K, V> From<OrderedMap<K, V>> for Value
source§fn from(map: OrderedMap<K, V>) -> Self
fn from(map: OrderedMap<K, V>) -> Self
source§impl<K, V> FromIterator<(K, V)> for OrderedMap<K, V>
impl<K, V> FromIterator<(K, V)> for OrderedMap<K, V>
source§impl<K, V> Hash for OrderedMap<K, V>
impl<K, V> Hash for OrderedMap<K, V>
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, V> Ord for OrderedMap<K, V>
impl<K, V> Ord for OrderedMap<K, V>
source§impl<K, V> PartialEq for OrderedMap<K, V>
impl<K, V> PartialEq for OrderedMap<K, V>
source§impl<K, V> PartialOrd for OrderedMap<K, V>where
K: PartialOrd,
V: PartialOrd,
impl<K, V> PartialOrd for OrderedMap<K, V>where
K: PartialOrd,
V: PartialOrd,
source§impl<K, V> Serialize for OrderedMap<K, V>
impl<K, V> Serialize for OrderedMap<K, V>
source§impl<K, V> TryFrom<Value> for OrderedMap<K, V>
impl<K, V> TryFrom<Value> for OrderedMap<K, V>
impl<K, V> Eq for OrderedMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for OrderedMap<K, V>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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
key
and return true
if they are equal.