Struct lattices::collections::OptionMap
source · pub struct OptionMap<K, V>(pub Option<(K, V)>);
Expand description
A key-value entry wrapper around Option<(K, V)>
representing a singleton or empty map.
Tuple Fields§
§0: Option<(K, V)>
Trait Implementations§
source§impl<K, V> CollectionMut for OptionMap<K, V>
impl<K, V> CollectionMut for OptionMap<K, V>
source§type ItemMut<'a> = &'a mut <OptionMap<K, V> as Collection>::Item
where
Self: 'a
type ItemMut<'a> = &'a mut <OptionMap<K, V> as Collection>::Item where Self: 'a
Type of mutable references to items of the collection.
source§fn upcast_item_mut<'short, 'long: 'short>(
r: Self::ItemMut<'long>,
) -> Self::ItemMut<'short>where
Self: 'long,
fn upcast_item_mut<'short, 'long: 'short>(
r: Self::ItemMut<'long>,
) -> Self::ItemMut<'short>where
Self: 'long,
Changes an item mutable reference into a shorter lived mutable reference. Read more
source§impl<K, V> CollectionRef for OptionMap<K, V>
impl<K, V> CollectionRef for OptionMap<K, V>
source§type ItemRef<'a> = &'a <OptionMap<K, V> as Collection>::Item
where
Self: 'a
type ItemRef<'a> = &'a <OptionMap<K, V> as Collection>::Item where Self: 'a
Type of references to items of the collection.
source§fn upcast_item_ref<'short, 'long: 'short>(
r: Self::ItemRef<'long>,
) -> Self::ItemRef<'short>where
Self: 'long,
fn upcast_item_ref<'short, 'long: 'short>(
r: Self::ItemRef<'long>,
) -> Self::ItemRef<'short>where
Self: 'long,
Changes an item reference into a shorter lived reference. Read more
source§impl<'de, K, V> Deserialize<'de> for OptionMap<K, V>where
K: Deserialize<'de>,
V: Deserialize<'de>,
impl<'de, K, V> Deserialize<'de> for OptionMap<K, V>where
K: Deserialize<'de>,
V: Deserialize<'de>,
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<'a, Q, K, V> GetKeyValue<&'a Q> for OptionMap<K, V>
impl<'a, Q, K, V> GetKeyValue<&'a Q> for OptionMap<K, V>
source§fn get_key_value(
&self,
key: &'a Q,
) -> Option<(Self::KeyRef<'_>, Self::ItemRef<'_>)>
fn get_key_value( &self, key: &'a Q, ) -> Option<(Self::KeyRef<'_>, Self::ItemRef<'_>)>
Returns the key-value pair matching the given
key
.source§impl<'a, Q, K, V> GetKeyValueMut<&'a Q> for OptionMap<K, V>
impl<'a, Q, K, V> GetKeyValueMut<&'a Q> for OptionMap<K, V>
source§fn get_key_value_mut(
&mut self,
key: &'a Q,
) -> Option<(Self::KeyRef<'_>, Self::ItemMut<'_>)>
fn get_key_value_mut( &mut self, key: &'a Q, ) -> Option<(Self::KeyRef<'_>, Self::ItemMut<'_>)>
Returns the key-value pair matching the given
key
, with a mutable reference to the value.source§impl<K, V> IntoIterator for OptionMap<K, V>
impl<K, V> IntoIterator for OptionMap<K, V>
source§impl<K, V> KeyedRef for OptionMap<K, V>
impl<K, V> KeyedRef for OptionMap<K, V>
source§type KeyRef<'a> = &'a <OptionMap<K, V> as Keyed>::Key
where
Self: 'a
type KeyRef<'a> = &'a <OptionMap<K, V> as Keyed>::Key where Self: 'a
Type of references to keys of the collection.
source§fn upcast_key_ref<'short, 'long: 'short>(
r: Self::KeyRef<'long>,
) -> Self::KeyRef<'short>where
Self: 'long,
fn upcast_key_ref<'short, 'long: 'short>(
r: Self::KeyRef<'long>,
) -> Self::KeyRef<'short>where
Self: 'long,
Changes a key reference into a shorter lived reference. Read more
source§impl<K, OldVal> MapMapValues<OldVal> for OptionMap<K, OldVal>
impl<K, OldVal> MapMapValues<OldVal> for OptionMap<K, OldVal>
source§impl<K: Ord, V: Ord> Ord for OptionMap<K, V>
impl<K: Ord, V: Ord> Ord for OptionMap<K, V>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<K: PartialOrd, V: PartialOrd> PartialOrd for OptionMap<K, V>
impl<K: PartialOrd, V: PartialOrd> PartialOrd for OptionMap<K, V>
impl<K: Copy, V: Copy> Copy for OptionMap<K, V>
impl<K: Eq, V: Eq> Eq for OptionMap<K, V>
impl<K, V> StructuralPartialEq for OptionMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for OptionMap<K, V>
impl<K, V> RefUnwindSafe for OptionMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for OptionMap<K, V>
impl<K, V> Sync for OptionMap<K, V>
impl<K, V> Unpin for OptionMap<K, V>
impl<K, V> UnwindSafe for OptionMap<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<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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more