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

Method next

crates/vm/src/builtins/enumerate.rs:79–85  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

77
78impl IterNext for PyEnumerate {
79 fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
80 let next_obj = raise_if_stop!(zelf.iterable.next(vm)?);
81 let mut counter = zelf.counter.write();
82 let position = counter.clone();
83 *counter += 1;
84 Ok(PyIterReturn::Return((position, next_obj).to_pyobject(vm)))
85 }
86}
87
88#[pyclass(module = false, name = "reversed", traverse)]

Callers

nothing calls this directly

Calls 6

rev_nextMethod · 0.80
writeMethod · 0.45
cloneMethod · 0.45
to_pyobjectMethod · 0.45
lockMethod · 0.45
get_itemMethod · 0.45

Tested by

no test coverage detected