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

Method count

crates/vm/src/stdlib/_collections.rs:109–117  ·  view source on GitHub ↗
(&self, obj: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

107
108 #[pymethod]
109 fn count(&self, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> {
110 let start_state = self.state.load();
111 let count = self.mut_count(vm, &obj)?;
112
113 if start_state != self.state.load() {
114 return Err(vm.new_runtime_error("deque mutated during iteration"));
115 }
116 Ok(count)
117 }
118
119 #[pymethod]
120 fn extend(&self, iter: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {

Callers 7

decode_source_bytesFunction · 0.45
len_strMethod · 0.45
char_lenMethod · 0.45
count_placeholdersFunction · 0.45
wchar_array_set_valueFunction · 0.45
set_primitiveFunction · 0.45
from_paramMethod · 0.45

Calls 3

mut_countMethod · 0.80
ErrClass · 0.50
loadMethod · 0.45

Tested by

no test coverage detected