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> Collection for OptionMap<K, V>
impl<K, V> Collection for OptionMap<K, V>
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
OptionMap<K, V>: 'a
type ItemMut<'a> = &'a mut <OptionMap<K, V> as Collection>::Item where OptionMap<K, V>: 'a
Type of mutable references to items of the collection.
Source§fn upcast_item_mut<'short, 'long>(
r: <OptionMap<K, V> as CollectionMut>::ItemMut<'long>,
) -> <OptionMap<K, V> as CollectionMut>::ItemMut<'short>where
'long: 'short,
OptionMap<K, V>: 'long,
fn upcast_item_mut<'short, 'long>(
r: <OptionMap<K, V> as CollectionMut>::ItemMut<'long>,
) -> <OptionMap<K, V> as CollectionMut>::ItemMut<'short>where
'long: 'short,
OptionMap<K, V>: '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
OptionMap<K, V>: 'a
type ItemRef<'a> = &'a <OptionMap<K, V> as Collection>::Item where OptionMap<K, V>: 'a
Type of references to items of the collection.
Source§fn upcast_item_ref<'short, 'long>(
r: <OptionMap<K, V> as CollectionRef>::ItemRef<'long>,
) -> <OptionMap<K, V> as CollectionRef>::ItemRef<'short>where
'long: 'short,
OptionMap<K, V>: 'long,
fn upcast_item_ref<'short, 'long>(
r: <OptionMap<K, V> as CollectionRef>::ItemRef<'long>,
) -> <OptionMap<K, V> as CollectionRef>::ItemRef<'short>where
'long: 'short,
OptionMap<K, V>: '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<OptionMap<K, V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OptionMap<K, V>, <__D as Deserializer<'de>>::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§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§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§impl<K, V> MapIterMut for OptionMap<K, V>
impl<K, V> MapIterMut for OptionMap<K, V>
Source§impl<K, OldVal> MapMapValues<OldVal> for OptionMap<K, OldVal>
impl<K, OldVal> MapMapValues<OldVal> for OptionMap<K, OldVal>
Source§type MapValue<NewVal> = OptionMap<K, NewVal>
type MapValue<NewVal> = OptionMap<K, NewVal>
Output type, should be
Self but with OldVal replaced with NewVal.Source§fn map_values<NewVal, MapFn>(
self,
map_fn: MapFn,
) -> <OptionMap<K, OldVal> as MapMapValues<OldVal>>::MapValue<NewVal>where
MapFn: FnMut(OldVal) -> NewVal,
fn map_values<NewVal, MapFn>(
self,
map_fn: MapFn,
) -> <OptionMap<K, OldVal> as MapMapValues<OldVal>>::MapValue<NewVal>where
MapFn: FnMut(OldVal) -> NewVal,
Map the values into using the
map_fn.Source§impl<K, V> Ord for OptionMap<K, V>
impl<K, V> 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, V> PartialOrd for OptionMap<K, V>where
K: PartialOrd,
V: PartialOrd,
impl<K, V> PartialOrd for OptionMap<K, V>where
K: PartialOrd,
V: PartialOrd,
Source§impl<K, V> Serialize for OptionMap<K, V>
impl<K, V> Serialize for OptionMap<K, V>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl<K, V> SimpleCollectionRef for OptionMap<K, V>
impl<K, V> SimpleCollectionRef for OptionMap<K, V>
fn into_ref<'r>(
r: <OptionMap<K, V> as CollectionRef>::ItemRef<'r>,
) -> &'r <OptionMap<K, V> as Collection>::Itemwhere
OptionMap<K, V>: 'r,
Source§impl<K, V> SimpleKeyedRef for OptionMap<K, V>
impl<K, V> SimpleKeyedRef for OptionMap<K, V>
impl<K, V> Copy for OptionMap<K, V>
impl<K, V> 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§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§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 more