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

Method pop

crates/vm/src/dict_inner.rs:774–784  ·  view source on GitHub ↗

Retrieve and delete a key

(&self, vm: &VirtualMachine, key: &K)

Source from the content-addressed store, hash-verified

772
773 /// Retrieve and delete a key
774 pub fn pop<K: DictKey + ?Sized>(&self, vm: &VirtualMachine, key: &K) -> PyResult<Option<T>> {
775 let hash_value = key.key_hash(vm)?;
776 let removed = loop {
777 let lookup = self.lookup(vm, key, hash_value, None)?;
778 match self.pop_inner(lookup) {
779 ControlFlow::Break(entry) => break entry.map(|e| e.value),
780 ControlFlow::Continue(()) => continue,
781 }
782 };
783 Ok(removed)
784 }
785
786 pub fn pop_back(&self) -> Option<(PyObjectRef, T)> {
787 let inner = &mut *self.write();

Callers 1

pop_backMethod · 0.45

Calls 4

key_hashMethod · 0.80
pop_innerMethod · 0.80
lookupMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected