MCPcopy Index your code
hub / github.com/RustPython/RustPython / merge_dict

Method merge_dict

crates/vm/src/builtins/dict.rs:190–200  ·  view source on GitHub ↗
(&self, dict_other: PyDictRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

188 }
189
190 fn merge_dict(&self, dict_other: PyDictRef, vm: &VirtualMachine) -> PyResult<()> {
191 let dict = &self.entries;
192 let dict_size = &dict_other.size();
193 for (key, value) in &dict_other {
194 dict.insert(vm, &*key, value)?;
195 }
196 if dict_other.entries.has_changed_size(dict_size) {
197 return Err(vm.new_runtime_error("dict mutated during update"));
198 }
199 Ok(())
200 }
201
202 pub fn is_empty(&self) -> bool {
203 self.entries.len() == 0

Callers 3

merge_objectMethod · 0.45
__or__Method · 0.45
__ror__Method · 0.45

Calls 4

has_changed_sizeMethod · 0.80
ErrClass · 0.50
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected