pub struct defaultdict<K, V>{ /* private fields */ }Expand description
defaultdict - dict subclass with default factory function
Implementations§
Source§impl<K, V> defaultdict<K, V>
impl<K, V> defaultdict<K, V>
Sourcepub fn without_factory() -> Self
pub fn without_factory() -> Self
Create defaultdict without factory
Sourcepub fn get_or_default(&mut self, key: &K) -> Result<V, PyException>
pub fn get_or_default(&mut self, key: &K) -> Result<V, PyException>
Get value, creating with factory if missing
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Check if key exists
Sourcepub fn default_factory_fn(&self) -> Option<fn() -> V>
pub fn default_factory_fn(&self) -> Option<fn() -> V>
Get missing method (for compatibility)
Trait Implementations§
Source§impl<K, V> Clone for defaultdict<K, V>
impl<K, V> Clone for defaultdict<K, V>
Source§fn clone(&self) -> defaultdict<K, V>
fn clone(&self) -> defaultdict<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> Debug for defaultdict<K, V>
impl<K, V> Debug for defaultdict<K, V>
Source§impl<K, V> Len for defaultdict<K, V>
impl<K, V> Len for defaultdict<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for defaultdict<K, V>
impl<K, V> RefUnwindSafe for defaultdict<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for defaultdict<K, V>
impl<K, V> Sync for defaultdict<K, V>
impl<K, V> Unpin for defaultdict<K, V>
impl<K, V> UnwindSafe for defaultdict<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