pub struct OptionalDict<K: DictKey, V> { /* private fields */ }Expand description
A dictionary where keys may or may not have values
Implementations§
Source§impl<K: DictKey, V> OptionalDict<K, V>
impl<K: DictKey, V> OptionalDict<K, V>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn from_fn<F>(f: F) -> Self
pub fn try_from_fn<F, E>(f: F) -> Result<Self, E>
pub fn map<F, U>(self, f: F) -> OptionalDict<K, U>where
F: FnMut(V) -> U,
pub fn try_map<F, U, E>(self, f: F) -> Result<OptionalDict<K, U>, E>
pub fn each_ref(&self) -> OptionalDict<K, &V>
pub fn each_mut(&mut self) -> OptionalDict<K, &mut V>
pub fn upgrade(self) -> Result<RequiredDict<K, V>, Self>
Trait Implementations§
Source§impl<K: DictKey, V> Default for OptionalDict<K, V>
impl<K: DictKey, V> Default for OptionalDict<K, V>
Source§impl<K: DictKey, V> From<OptionalDict<K, V>> for RequiredDict<K, Option<V>>
impl<K: DictKey, V> From<OptionalDict<K, V>> for RequiredDict<K, Option<V>>
Source§fn from(dict: OptionalDict<K, V>) -> Self
fn from(dict: OptionalDict<K, V>) -> Self
Converts to this type from the input type.
Source§impl<K: DictKey, V> From<RequiredDict<K, Option<V>>> for OptionalDict<K, V>
impl<K: DictKey, V> From<RequiredDict<K, Option<V>>> for OptionalDict<K, V>
Source§fn from(dict: RequiredDict<K, Option<V>>) -> Self
fn from(dict: RequiredDict<K, Option<V>>) -> Self
Converts to this type from the input type.
Source§impl<K: DictKey, V> Index<K> for OptionalDict<K, V>
impl<K: DictKey, V> Index<K> for OptionalDict<K, V>
Source§impl<K: DictKey, V> IndexMut<K> for OptionalDict<K, V>
impl<K: DictKey, V> IndexMut<K> for OptionalDict<K, V>
Source§impl<K: DictKey, V> IntoIterator for OptionalDict<K, V>
impl<K: DictKey, V> IntoIterator for OptionalDict<K, V>
Source§impl<K: DictKey, V: Ord> Ord for OptionalDict<K, V>
impl<K: DictKey, V: Ord> Ord for OptionalDict<K, V>
Source§impl<K: DictKey, V: PartialOrd> PartialOrd for OptionalDict<K, V>
impl<K: DictKey, V: PartialOrd> PartialOrd for OptionalDict<K, V>
impl<K: DictKey, V: Copy> Copy for OptionalDict<K, V>
impl<K: DictKey, V: Eq> Eq for OptionalDict<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for OptionalDict<K, V>
impl<K, V> RefUnwindSafe for OptionalDict<K, V>
impl<K, V> Send for OptionalDict<K, V>
impl<K, V> Sync for OptionalDict<K, V>
impl<K, V> Unpin for OptionalDict<K, V>
impl<K, V> UnwindSafe for OptionalDict<K, V>
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