pub struct OrderedAssociated<K, V> { /* private fields */ }Expand description
An ordered, deduplicated slice of items each paired with some associated value.
Like Ordered, the contained Vec<(K, V)> is sealed after construction and cannot be modified. To unseal the
inner Vec<(K, V)>, use the Into<Vec<(K, V)>> impl.
Consumers that only need the ordered keys can treat an OrderedAssociated as an
Ordered through deref coercions.
Implementations§
Source§impl<K, V> OrderedAssociated<K, V>
impl<K, V> OrderedAssociated<K, V>
Sourcepub fn position(&self, key: &K) -> Option<usize>where
K: Ord,
pub fn position(&self, key: &K) -> Option<usize>where
K: Ord,
Returns the position of the provided key, if it exists.
Sourcepub fn value(&self, index: usize) -> Option<&V>
pub fn value(&self, index: usize) -> Option<&V>
Returns the associated value at index, if it exists.
Sourcepub fn get_value(&self, key: &K) -> Option<&V>where
K: Ord,
pub fn get_value(&self, key: &K) -> Option<&V>where
K: Ord,
Returns the associated value for key, if it exists.
Sourcepub fn iter_pairs(&self) -> impl Iterator<Item = (&K, &V)>
pub fn iter_pairs(&self) -> impl Iterator<Item = (&K, &V)>
Returns a zipped iterator over keys and values.
Methods from Deref<Target = Ordered<K>>§
Trait Implementations§
Source§impl<K, V> AsRef<[K]> for OrderedAssociated<K, V>
impl<K, V> AsRef<[K]> for OrderedAssociated<K, V>
Source§impl<K, V> AsRef<Ordered<K>> for OrderedAssociated<K, V>
impl<K, V> AsRef<Ordered<K>> for OrderedAssociated<K, V>
Source§impl<K: Clone, V: Clone> Clone for OrderedAssociated<K, V>
impl<K: Clone, V: Clone> Clone for OrderedAssociated<K, V>
Source§fn clone(&self) -> OrderedAssociated<K, V>
fn clone(&self) -> OrderedAssociated<K, V>
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<K, V> Deref for OrderedAssociated<K, V>
impl<K, V> Deref for OrderedAssociated<K, V>
Source§impl<K: EncodeSize, V: EncodeSize> EncodeSize for OrderedAssociated<K, V>
impl<K: EncodeSize, V: EncodeSize> EncodeSize for OrderedAssociated<K, V>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Returns the encoded size of this value (in bytes).
Source§impl<K: Ord + Clone, V: Clone, const N: usize> From<&[(K, V); N]> for OrderedAssociated<K, V>
impl<K: Ord + Clone, V: Clone, const N: usize> From<&[(K, V); N]> for OrderedAssociated<K, V>
Source§impl<K: Ord, V> From<OrderedAssociated<K, V>> for Vec<(K, V)>
impl<K: Ord, V> From<OrderedAssociated<K, V>> for Vec<(K, V)>
Source§fn from(wrapped: OrderedAssociated<K, V>) -> Self
fn from(wrapped: OrderedAssociated<K, V>) -> Self
Converts to this type from the input type.
Source§impl<K: Ord, V> FromIterator<(K, V)> for OrderedAssociated<K, V>
impl<K: Ord, V> FromIterator<(K, V)> for OrderedAssociated<K, V>
Source§impl<'a, K, V> IntoIterator for &'a OrderedAssociated<K, V>
impl<'a, K, V> IntoIterator for &'a OrderedAssociated<K, V>
Source§impl<K, V> IntoIterator for OrderedAssociated<K, V>
impl<K, V> IntoIterator for OrderedAssociated<K, V>
Source§impl<K: Read, V: Read> Read for OrderedAssociated<K, V>
impl<K: Read, V: Read> Read for OrderedAssociated<K, V>
impl<K: Eq, V: Eq> Eq for OrderedAssociated<K, V>
impl<K, V> StructuralPartialEq for OrderedAssociated<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for OrderedAssociated<K, V>
impl<K, V> RefUnwindSafe for OrderedAssociated<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for OrderedAssociated<K, V>
impl<K, V> Sync for OrderedAssociated<K, V>
impl<K, V> Unpin for OrderedAssociated<K, V>
impl<K, V> UnwindSafe for OrderedAssociated<K, V>where
V: UnwindSafe,
K: 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