pub struct AddableDict(pub HashMap<String, Value>);Expand description
Dictionary that can be added to another dictionary.
When adding two AddableDict instances:
- Keys only in the other dict are added
- Keys with null values in self are replaced
- Values that support addition are added together
- Otherwise the value from other replaces the value in self
Tuple Fields§
§0: HashMap<String, Value>Implementations§
Source§impl AddableDict
impl AddableDict
Sourcepub fn from_map(map: HashMap<String, Value>) -> Self
pub fn from_map(map: HashMap<String, Value>) -> Self
Create an AddableDict from an existing HashMap
Sourcepub fn insert(&mut self, key: impl Into<String>, value: Value)
pub fn insert(&mut self, key: impl Into<String>, value: Value)
Insert a key-value pair into the dictionary
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Check if the dictionary contains a key
Trait Implementations§
Source§impl Add for AddableDict
impl Add for AddableDict
Source§impl AddAssign for AddableDict
impl AddAssign for AddableDict
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl Clone for AddableDict
impl Clone for AddableDict
Source§fn clone(&self) -> AddableDict
fn clone(&self) -> AddableDict
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 Debug for AddableDict
impl Debug for AddableDict
Source§impl Default for AddableDict
impl Default for AddableDict
Source§fn default() -> AddableDict
fn default() -> AddableDict
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AddableDict
impl<'de> Deserialize<'de> for AddableDict
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
Auto Trait Implementations§
impl Freeze for AddableDict
impl RefUnwindSafe for AddableDict
impl Send for AddableDict
impl Sync for AddableDict
impl Unpin for AddableDict
impl UnwindSafe for AddableDict
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